java.lang.reflect and/or Annotation Processing.
This interface provides navigation over the reflection model
to decouple the caller from any particular implementation.
This allows the JAXB RI to reuse much of the code between
the compile time (which works on top of Annotation Processing) and the run-time
(which works on top of java.lang.reflect)
Navigator instances are stateless and immutable.
A Java class declaration (not an interface, a class and an enum.)
A Java type. This includs declaration, but also includes such things like arrays, primitive types, parameterized types, and etc.
| Modifier and Type | Method and Description |
|---|---|
| public C | |
| public C | |
| public <P> T | |
| public T | Returns: The use ofbaseType in type.
or null if the type is not assignable to the base type.The type that derives from type, C baseTypeThe class whose parameterization we are interested in. baseType)Gets the parameterization of the given base type. |
| public Location | |
| public String | |
| public String | getClassShortName(C clazz)
Gets the short name of the class ("Object" for |
| public T | |
| public F | Returns: null if not foundGets the named field declared on the given class. |
| public Collection | |
| public Collection | Returns: can be empty but always non-null.Gets all the declared methods of the given class (regardless of their access modifiers, regardless of whether they override methods of the base classes.) Note that this method does not list methods declared on base classes. |
| public C | |
| public C | |
| public F[] | Returns: can be empty but never null.must derive from clazz)Enum.Gets the enumeration constants from an enum class. |
| public Location | |
| public String | |
| public T | |
| public Location | |
| public String | |
| public T[] | |
| public String | Returns: i.e. "", "java.lang" but not null.Gets the package name of the given class. |
| public T | getPrimitive(Class<?>
must be Class objects like primitiveType)Integer#TYPE.Returns the representation for the given primitive type. |
| public T | |
| public C | Returns: null if the parameter representsObject.Gets the base class of the specified class. |
| public T | |
| public String | Returns: a human-readable name that the type represents.Gets the display name of the type object |
| public T | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | isOverriding(M method, C base)
Returns true if the given method is overriding another one defined in the base class 'base' or its ancestors. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public C | Returns: null if not found.The class that refers to the specified class. referencePoint, String packageName)Finds ObjectFactory for the given referencePoint. |
| public T | |
| public T |
| asDecl | back to summary |
|---|---|
| public C asDecl(T type) If the given type is an use of class declaration,
returns the type casted as Todo define the exact semantics. | |
| asDecl | back to summary |
|---|---|
| public C asDecl(Class<?> c) Gets the | |
| erasure | back to summary |
|---|---|
| public <P> T erasure(T contentInMemoryType) Computes the erasure | |
| getBaseClass | back to summary |
|---|---|
| public T getBaseClass(T type, C baseType) Gets the parameterization of the given base type. For example, given the following
This method works like this:
| |
| getClassLocation | back to summary |
|---|---|
| public Location getClassLocation(C clazz) Returns a location of the specified class. | |
| getClassName | back to summary |
|---|---|
| public String getClassName(C clazz) Gets the fully-qualified name of the class.
("java.lang.Object" for | |
| getClassShortName | back to summary |
|---|---|
| public String getClassShortName(C clazz) Gets the short name of the class ("Object" for | |
| getComponentType | back to summary |
|---|---|
| public T getComponentType(T t) Gets the component type of the array.
| |
| getDeclaredField | back to summary |
|---|---|
| public F getDeclaredField(C clazz, String fieldName) Gets the named field declared on the given class. This method doesn't visit ancestors, but does recognize non-public fields.
| |
| getDeclaredFields | back to summary |
|---|---|
| public Collection Gets all the declared fields of the given class. | |
| getDeclaredMethods | back to summary |
|---|---|
| public Collection Gets all the declared methods of the given class (regardless of their access modifiers, regardless of whether they override methods of the base classes.) Note that this method does not list methods declared on base classes.
| |
| getDeclaringClassForField | back to summary |
|---|---|
| public C getDeclaringClassForField(F field) Gets the class that declares the given field. | |
| getDeclaringClassForMethod | back to summary |
|---|---|
| public C getDeclaringClassForMethod(M method) Gets the class that declares the given method. | |
| getEnumConstants | back to summary |
|---|---|
| public F[] getEnumConstants(C clazz) Gets the enumeration constants from an enum class.
| |
| getFieldLocation | back to summary |
|---|---|
| public Location getFieldLocation(F field) | |
| getFieldName | back to summary |
|---|---|
| public String getFieldName(F field) Gets the name of the field. | |
| getFieldType | back to summary |
|---|---|
| public T getFieldType(F f) Gets the type of the field. | |
| getMethodLocation | back to summary |
|---|---|
| public Location getMethodLocation(M getter) | |
| getMethodName | back to summary |
|---|---|
| public String getMethodName(M m) Gets the name of the method, such as "toString" or "equals". | |
| getMethodParameters | back to summary |
|---|---|
| public T[] getMethodParameters(M method) Returns the list of parameters to the method. | |
| getPackageName | back to summary |
|---|---|
| public String getPackageName(C clazz) Gets the package name of the given class.
| |
| getPrimitive | back to summary |
|---|---|
| public T getPrimitive(Class<?> primitiveType) Returns the representation for the given primitive type.
| |
| getReturnType | back to summary |
|---|---|
| public T getReturnType(M m) Gets the return type of a method. | |
| getSuperClass | back to summary |
|---|---|
| public C getSuperClass(C clazz) Gets the base class of the specified class.
| |
| getTypeArgument | back to summary |
|---|---|
| public T getTypeArgument(T t, int i) Gets the i-th type argument from a parameterized type.
For example,
| |
| getTypeName | back to summary |
|---|---|
| public String getTypeName(T rawType) Gets the display name of the type object
| |
| getVoidType | back to summary |
|---|---|
| public T getVoidType() Gets the representation of the primitive "void" type. | |
| hasDefaultConstructor | back to summary |
|---|---|
| public boolean hasDefaultConstructor(C clazz) Returns true if the given class has a no-arg default constructor. The constructor does not need to be public. | |
| isAbstract | back to summary |
|---|---|
| public boolean isAbstract(C clazz) Returns true if this is an abstract class. | |
| isArray | back to summary |
|---|---|
| public boolean isArray(T t) Checks if the type is an array type. | |
| isArrayButNotByteArray | back to summary |
|---|---|
| public boolean isArrayButNotByteArray(T t) Checks if the type is an array type but not byte[]. | |
| isBridgeMethod | back to summary |
|---|---|
| public boolean isBridgeMethod(M method) Returns true if this method is a bridge method as defined in JLS. | |
| isEnum | back to summary |
|---|---|
| public boolean isEnum(C clazz) Returns true if this is an enum class. | |
| isFinal | back to summary |
|---|---|
| public boolean isFinal(C clazz) Returns true if this is a final class. | |
| isFinalMethod | back to summary |
|---|---|
| public boolean isFinalMethod(M method) Returns true if the method is final. | |
| isInnerClass | back to summary |
|---|---|
| public boolean isInnerClass(C clazz) Returns true if the given class is an inner class. This is only used to improve the error diagnostics, so it's OK to fail to detect some inner classes as such. Note that this method should return false for nested classes (static classes.) | |
| isInterface | back to summary |
|---|---|
| public boolean isInterface(C clazz) Returns true if 'clazz' is an interface. | |
| isOverriding | back to summary |
|---|---|
| public boolean isOverriding(M method, C base) Returns true if the given method is overriding another one defined in the base class 'base' or its ancestors. | |
| isParameterizedType | back to summary |
|---|---|
| public boolean isParameterizedType(T t) Returns true if t is a parameterized type. | |
| isPrimitive | back to summary |
|---|---|
| public boolean isPrimitive(T t) Checks if the given type is a primitive type. | |
| isPublicField | back to summary |
|---|---|
| public boolean isPublicField(F field) Returns true if the field is public. | |
| isPublicMethod | back to summary |
|---|---|
| public boolean isPublicMethod(M method) Returns true if the method is public. | |
| isSameType | back to summary |
|---|---|
| public boolean isSameType(T t1, T t2) Checks if types are the same
| |
| isStaticField | back to summary |
|---|---|
| public boolean isStaticField(F field) Returns true if the field is static. | |
| isStaticMethod | back to summary |
|---|---|
| public boolean isStaticMethod(M method) Returns true if the method is static. | |
| isSubClassOf | back to summary |
|---|---|
| public boolean isSubClassOf(T sub, T sup) Checks if Todo should this method take T or C? | |
| isTransient | back to summary |
|---|---|
| public boolean isTransient(F f) Returns true if the field is transient. | |
| loadObjectFactory | back to summary |
|---|---|
| public C loadObjectFactory(C referencePoint, String packageName) Finds ObjectFactory for the given referencePoint.
| |
| ref | back to summary |
|---|---|
| public T ref(Class<?> c) Gets the representation of the given Java type in
| |
| use | back to summary |
|---|---|
| public T use(C c) Gets the T for the given C. | |