public final class NavigatorImpl extends Object implements Navigator<NType,NClass,Void,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 and Description |
|---|---|
static NavigatorImpl |
theInstance |
| Modifier and Type | Method and Description |
|---|---|
NClass |
asDecl(Class c)
Gets the
C representation for the given class. |
NClass |
asDecl(NType nt)
If the given type is an use of class declaration,
returns the type casted as
C. |
static NClass |
create(Class c) |
static NType |
create(Type t) |
static NType |
createParameterizedType(Class rawType,
NType... args) |
static NType |
createParameterizedType(NClass rawType,
NType... args)
Creates a
NType representation for a parameterized type
RawType<ParamType1,ParamType2,...> . |
<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.
|
String |
getClassName(NClass nClass)
Gets the fully-qualified name of the class.
|
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.
|
Void |
getDeclaredField(NClass clazz,
String fieldName)
Gets the named field declared on the given class.
|
Collection<? extends Void> |
getDeclaredFields(NClass nClass)
Gets all the declared fields of the given class.
|
Collection<? extends 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(Void aVoid)
Gets the class that declares the given field.
|
NClass |
getDeclaringClassForMethod(Void aVoid)
Gets the class that declares the given method.
|
Void[] |
getEnumConstants(NClass clazz)
Gets the enumeration constants from an enum class.
|
Location |
getFieldLocation(Void v) |
String |
getFieldName(Void aVoid)
Gets the name of the field.
|
NType |
getFieldType(Void aVoid)
Gets the type of the field.
|
Location |
getMethodLocation(Void v) |
String |
getMethodName(Void aVoid)
Gets the name of the method, such as "toString" or "equals".
|
NType[] |
getMethodParameters(Void aVoid)
Returns the list of parameters to the method.
|
String |
getPackageName(NClass clazz)
Gets the package name of the given class.
|
NType |
getPrimitive(Class primitiveType)
Returns the representation for the given primitive type.
|
NType |
getReturnType(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.
|
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(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(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(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(Void aVoid)
Returns true if the field is public.
|
boolean |
isPublicMethod(Void aVoid)
Returns true if the method is public.
|
boolean |
isSameType(NType t1,
NType t2)
Checks if types are the same
|
boolean |
isStaticField(Void aVoid)
Returns true if the field is static.
|
boolean |
isStaticMethod(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(Void f)
Returns true if the field is transient.
|
NClass |
loadObjectFactory(NClass referencePoint,
String pkg)
Finds ObjectFactory for the given referencePoint.
|
NClass |
ref(Class c)
Gets the representation of the given Java type in
T. |
NClass |
ref(JClass c) |
NType |
use(NClass nc)
Gets the T for the given C.
|
public static final NavigatorImpl theInstance
public NClass getSuperClass(NClass nClass)
Navigatorpublic 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>
public String getClassName(NClass nClass)
NavigatorObject)public String getTypeName(NType type)
Navigatorpublic String getClassShortName(NClass nClass)
NavigatorObject.)
For nested classes, this method should just return the inner name.
(for example "Inner" for "com.acme.Outer$Inner".public Collection<? extends Void> getDeclaredFields(NClass nClass)
Navigatorpublic Void getDeclaredField(NClass clazz, String fieldName)
Navigatorpublic Collection<? extends Void> getDeclaredMethods(NClass nClass)
NavigatorNote that this method does not list methods declared on base classes.
public NClass getDeclaringClassForField(Void aVoid)
Navigatorpublic NClass getDeclaringClassForMethod(Void aVoid)
Navigatorpublic NType getFieldType(Void aVoid)
Navigatorpublic String getFieldName(Void aVoid)
Navigatorpublic String getMethodName(Void aVoid)
Navigatorpublic NType getReturnType(Void aVoid)
Navigatorpublic NType[] getMethodParameters(Void aVoid)
Navigatorpublic boolean isStaticMethod(Void aVoid)
Navigatorpublic boolean isFinalMethod(Void aVoid)
Navigatorpublic boolean isSubClassOf(NType sub, NType sup)
Navigatorsub is a sub-type of sup.
TODO: should this method take T or C?public NClass ref(Class c)
NavigatorT.public NType use(NClass nc)
Navigatorpublic NClass asDecl(NType nt)
NavigatorC.
Otherwise null.
TODO: define the exact semantics.
public NClass asDecl(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)
Navigatorpublic NType getComponentType(NType nType)
Navigatorpublic NType getTypeArgument(NType nt, int i)
NavigatorgetTypeArgument([Map<Integer,String>],0)=IntegergetTypeArgument in interface Navigator<NType,NClass,Void,Void>Navigator.isParameterizedType(Object)public boolean isParameterizedType(NType nt)
Navigatorpublic boolean isPrimitive(NType type)
Navigatorpublic NType getPrimitive(Class primitiveType)
NavigatorgetPrimitive in interface Navigator<NType,NClass,Void,Void>primitiveType - must be Class objects like Integer.TYPE.public static NType createParameterizedType(NClass rawType, NType... args)
NType representation for a parameterized type
RawType<ParamType1,ParamType2,...> .public Location getClassLocation(NClass c)
Navigatorpublic boolean hasDefaultConstructor(NClass nClass)
Navigatorpublic boolean isStaticField(Void aVoid)
Navigatorpublic boolean isPublicMethod(Void aVoid)
Navigatorpublic boolean isPublicField(Void aVoid)
Navigatorpublic boolean isEnum(NClass c)
Navigatorpublic <T> NType erasure(NType type)
Navigatorpublic boolean isAbstract(NClass clazz)
Navigatorpublic boolean isFinal(NClass clazz)
Navigatorpublic Void[] getEnumConstants(NClass clazz)
Navigatorpublic NType getVoidType()
Navigatorpublic String getPackageName(NClass clazz)
Navigatorpublic NClass loadObjectFactory(NClass referencePoint, String pkg)
Navigatorpublic boolean isBridgeMethod(Void method)
Navigatorpublic boolean isOverriding(Void method, NClass clazz)
Navigatorpublic boolean isInterface(NClass clazz)
Navigatorpublic boolean isTransient(Void f)
Navigatorpublic boolean isInnerClass(NClass clazz)
NavigatorCopyright © 2018 JBoss by Red Hat. All rights reserved.