public final class NavigatorImpl extends java.lang.Object implements Navigator<NType,NClass,java.lang.Void,java.lang.Void>
Navigator implementation for XJC.
Most of the Navigator methods are used for parsing the model, which doesn't happen
in XJC. So Most of the methods aren't really implemented. Implementations should
be filled in as needed.| Modifier and Type | Field | Description |
|---|---|---|
static NavigatorImpl |
theInstance |
| Modifier and Type | Method | Description |
|---|---|---|
NClass |
asDecl(NType nt) |
If the given type is an use of class declaration,
returns the type casted as
C. |
NClass |
asDecl(java.lang.Class c) |
Gets the
C representation for the given class. |
static NClass |
create(java.lang.Class c) |
|
static NType |
create(java.lang.reflect.Type t) |
|
static NType |
createParameterizedType(NClass rawType,
NType... args) |
Creates a
NType representation for a parameterized type
RawType<ParamType1,ParamType2,...> . |
static NType |
createParameterizedType(java.lang.Class rawType,
NType... args) |
|
<T> NType |
erasure(NType type) |
Computes the erasure
|
NType |
getBaseClass(NType nt,
NClass base) |
Gets the parameterization of the given base type.
|
Location |
getClassLocation(NClass c) |
Returns a location of the specified class.
|
java.lang.String |
getClassName(NClass nClass) |
Gets the fully-qualified name of the class.
|
java.lang.String |
getClassShortName(NClass nClass) |
Gets the short name of the class ("Object" for
Object.)
For nested classes, this method should just return the inner name. |
NType |
getComponentType(NType nType) |
Gets the component type of the array.
|
java.lang.Void |
getDeclaredField(NClass clazz,
java.lang.String fieldName) |
Gets the named field declared on the given class.
|
java.util.Collection<? extends java.lang.Void> |
getDeclaredFields(NClass nClass) |
Gets all the declared fields of the given class.
|
java.util.Collection<? extends java.lang.Void> |
getDeclaredMethods(NClass nClass) |
Gets all the declared methods of the given class
(regardless of their access modifiers, regardless
of whether they override methods of the base classes.)
|
NClass |
getDeclaringClassForField(java.lang.Void aVoid) |
Gets the class that declares the given field.
|
NClass |
getDeclaringClassForMethod(java.lang.Void aVoid) |
Gets the class that declares the given method.
|
java.lang.Void[] |
getEnumConstants(NClass clazz) |
Gets the enumeration constants from an enum class.
|
Location |
getFieldLocation(java.lang.Void v) |
|
java.lang.String |
getFieldName(java.lang.Void aVoid) |
Gets the name of the field.
|
NType |
getFieldType(java.lang.Void aVoid) |
Gets the type of the field.
|
Location |
getMethodLocation(java.lang.Void v) |
|
java.lang.String |
getMethodName(java.lang.Void aVoid) |
Gets the name of the method, such as "toString" or "equals".
|
NType[] |
getMethodParameters(java.lang.Void aVoid) |
Returns the list of parameters to the method.
|
java.lang.String |
getPackageName(NClass clazz) |
Gets the package name of the given class.
|
NType |
getPrimitive(java.lang.Class primitiveType) |
Returns the representation for the given primitive type.
|
NType |
getReturnType(java.lang.Void aVoid) |
Gets the return type of a method.
|
NClass |
getSuperClass(NClass nClass) |
Gets the base class of the specified class.
|
NType |
getTypeArgument(NType nt,
int i) |
Gets the i-th type argument from a parameterized type.
|
java.lang.String |
getTypeName(NType type) |
Gets the display name of the type object
|
NType |
getVoidType() |
Gets the representation of the primitive "void" type.
|
boolean |
hasDefaultConstructor(NClass nClass) |
Returns true if the given class has a no-arg default constructor.
|
boolean |
isAbstract(NClass clazz) |
Returns true if this is an abstract class.
|
boolean |
isArray(NType nType) |
Checks if the type is an array type.
|
boolean |
isArrayButNotByteArray(NType t) |
Checks if the type is an array type but not byte[].
|
boolean |
isBridgeMethod(java.lang.Void method) |
Returns true if this method is a bridge method as defined in JLS.
|
boolean |
isEnum(NClass c) |
Returns true if this is an enum class.
|
boolean |
isFinal(NClass clazz) |
Deprecated.
no class generated by XJC is final.
|
boolean |
isFinalMethod(java.lang.Void aVoid) |
Returns true if the method is final.
|
boolean |
isInnerClass(NClass clazz) |
Returns true if the given class is an inner class.
|
boolean |
isInterface(NClass clazz) |
Returns true if 'clazz' is an interface.
|
boolean |
isOverriding(java.lang.Void method,
NClass clazz) |
Returns true if the given method is overriding another one
defined in the base class 'base' or its ancestors.
|
boolean |
isParameterizedType(NType nt) |
Returns true if t is a parameterized type.
|
boolean |
isPrimitive(NType type) |
Checks if the given type is a primitive type.
|
boolean |
isPublicField(java.lang.Void aVoid) |
Returns true if the field is public.
|
boolean |
isPublicMethod(java.lang.Void aVoid) |
Returns true if the method is public.
|
boolean |
isSameType(NType t1,
NType t2) |
Checks if types are the same
|
boolean |
isStaticField(java.lang.Void aVoid) |
Returns true if the field is static.
|
boolean |
isStaticMethod(java.lang.Void aVoid) |
Returns true if the method is static.
|
boolean |
isSubClassOf(NType sub,
NType sup) |
Checks if
sub is a sub-type of sup. |
boolean |
isTransient(java.lang.Void f) |
Returns true if the field is transient.
|
NClass |
loadObjectFactory(NClass referencePoint,
java.lang.String pkg) |
Finds ObjectFactory for the given referencePoint.
|
NClass |
ref(JClass c) |
|
NClass |
ref(java.lang.Class c) |
Gets the representation of the given Java type in
T. |
NType |
use(NClass nc) |
Gets the T for the given C.
|
public static final NavigatorImpl theInstance
public NClass getSuperClass(NClass nClass)
NavigatorgetSuperClass in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>Object.public NType getBaseClass(NType nt, NClass base)
NavigatorFor example, given the following
interface Foo<T> extends List<List<T>> {}
interface Bar extends Foo<String> {}
This method works like this:
getBaseClass( Bar, List ) = List<List<String>>
getBaseClass( Bar, Foo ) = Foo<String>
getBaseClass( Foo<? extends Number>, Collection ) = Collection<List<? extends Number>>
getBaseClass( ArrayList<? extends BigInteger>, List ) = List<? extends BigInteger>
getBaseClass in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>nt - The type that derives from baseTypebase - The class whose parameterization we are interested in.baseType in type.
or null if the type is not assignable to the base type.public java.lang.String getClassName(NClass nClass)
NavigatorObject)getClassName in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public java.lang.String getTypeName(NType type)
NavigatorgetTypeName in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public java.lang.String getClassShortName(NClass nClass)
NavigatorObject.)
For nested classes, this method should just return the inner name.
(for example "Inner" for "com.acme.Outer$Inner".getClassShortName in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public java.util.Collection<? extends java.lang.Void> getDeclaredFields(NClass nClass)
NavigatorgetDeclaredFields in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public java.lang.Void getDeclaredField(NClass clazz, java.lang.String fieldName)
NavigatorgetDeclaredField in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public java.util.Collection<? extends java.lang.Void> getDeclaredMethods(NClass nClass)
NavigatorNote that this method does not list methods declared on base classes.
getDeclaredMethods in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public NClass getDeclaringClassForField(java.lang.Void aVoid)
NavigatorgetDeclaringClassForField in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public NClass getDeclaringClassForMethod(java.lang.Void aVoid)
NavigatorgetDeclaringClassForMethod in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public NType getFieldType(java.lang.Void aVoid)
NavigatorgetFieldType in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public java.lang.String getFieldName(java.lang.Void aVoid)
NavigatorgetFieldName in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public java.lang.String getMethodName(java.lang.Void aVoid)
NavigatorgetMethodName in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public NType getReturnType(java.lang.Void aVoid)
NavigatorgetReturnType in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public NType[] getMethodParameters(java.lang.Void aVoid)
NavigatorgetMethodParameters in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isStaticMethod(java.lang.Void aVoid)
NavigatorisStaticMethod in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isFinalMethod(java.lang.Void aVoid)
NavigatorisFinalMethod in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isSubClassOf(NType sub, NType sup)
Navigatorsub is a sub-type of sup.
TODO: should this method take T or C?isSubClassOf in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public NClass ref(java.lang.Class c)
NavigatorT.public NType use(NClass nc)
Navigatorpublic NClass asDecl(NType nt)
NavigatorC.
Otherwise null.
TODO: define the exact semantics.
public NClass asDecl(java.lang.Class c)
NavigatorC representation for the given class.
The behavior is undefined if the class object represents
primitives, arrays, and other types that are not class declaration.public boolean isArray(NType nType)
Navigatorpublic boolean isArrayButNotByteArray(NType t)
NavigatorisArrayButNotByteArray in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public NType getComponentType(NType nType)
NavigatorgetComponentType in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>nType - must be an array.public NType getTypeArgument(NType nt, int i)
NavigatorgetTypeArgument([Map<Integer,String>],0)=IntegergetTypeArgument in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>Navigator.isParameterizedType(Object)public boolean isParameterizedType(NType nt)
NavigatorisParameterizedType in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isPrimitive(NType type)
NavigatorisPrimitive in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public NType getPrimitive(java.lang.Class primitiveType)
NavigatorgetPrimitive in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>primitiveType - must be Class objects like Integer.TYPE.public static final NType create(java.lang.reflect.Type t)
public static NClass create(java.lang.Class c)
public static NType createParameterizedType(NClass rawType, NType... args)
NType representation for a parameterized type
RawType<ParamType1,ParamType2,...> .public static NType createParameterizedType(java.lang.Class rawType, NType... args)
public Location getClassLocation(NClass c)
NavigatorgetClassLocation in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public Location getFieldLocation(java.lang.Void v)
getFieldLocation in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public Location getMethodLocation(java.lang.Void v)
getMethodLocation in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean hasDefaultConstructor(NClass nClass)
NavigatorhasDefaultConstructor in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isStaticField(java.lang.Void aVoid)
NavigatorisStaticField in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isPublicMethod(java.lang.Void aVoid)
NavigatorisPublicMethod in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isPublicField(java.lang.Void aVoid)
NavigatorisPublicField in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isEnum(NClass c)
Navigatorpublic <T> NType erasure(NType type)
Navigatorpublic boolean isAbstract(NClass clazz)
NavigatorisAbstract in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isFinal(NClass clazz)
Navigatorpublic java.lang.Void[] getEnumConstants(NClass clazz)
NavigatorgetEnumConstants in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>clazz - must derive from Enum.public NType getVoidType()
NavigatorgetVoidType in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public java.lang.String getPackageName(NClass clazz)
NavigatorgetPackageName in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public NClass loadObjectFactory(NClass referencePoint, java.lang.String pkg)
NavigatorloadObjectFactory in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>referencePoint - The class that refers to the specified class.public boolean isBridgeMethod(java.lang.Void method)
NavigatorisBridgeMethod in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isOverriding(java.lang.Void method,
NClass clazz)
NavigatorisOverriding in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isInterface(NClass clazz)
NavigatorisInterface in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isTransient(java.lang.Void f)
NavigatorisTransient in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>public boolean isInnerClass(NClass clazz)
NavigatorisInnerClass in interface Navigator<NType,NClass,java.lang.Void,java.lang.Void>Copyright © 2018 Oracle Corporation. All rights reserved.