public interface TypeDescription extends GenericTypeDescription, TypeVariableSource
GenericTypeDescription.Sort.NON_GENERIC.| Modifier and Type | Interface and Description |
|---|---|
static class |
TypeDescription.AbstractBase
An abstract base implementation of a type description.
|
static class |
TypeDescription.ArrayProjection
A projection for an array type based on an existing
TypeDescription. |
static class |
TypeDescription.ForLoadedType
A type description implementation that represents a loaded type.
|
static class |
TypeDescription.ForPackageDescription
A type representation of a package description.
|
static class |
TypeDescription.Latent
A latent type description for a type without methods or fields.
|
GenericTypeDescription.ForGenericArray, GenericTypeDescription.ForNonGenericType, GenericTypeDescription.ForParameterizedType, GenericTypeDescription.ForTypeVariable, GenericTypeDescription.ForWildcardType, GenericTypeDescription.LazyProjection, GenericTypeDescription.Sort, GenericTypeDescription.SuperTypeIterator, GenericTypeDescription.Visitor<T>TypeVariableSource.Visitor<T>ByteCodeElement.Accessible, ByteCodeElement.Token<T extends ByteCodeElement.Token<T>>, ByteCodeElement.TypeDependant<T extends ByteCodeElement.TypeDependant<?,S>,S extends ByteCodeElement.Token<S>>NamedElement.WithGenericName, NamedElement.WithRuntimeName| Modifier and Type | Field and Description |
|---|---|
static GenericTypeList |
ARRAY_INTERFACES
A list of interfaces that are implicitly implemented by any array type.
|
static int |
ARRAY_MODIFIERS
The modifiers of any array type.
|
static TypeDescription |
CLASS
A representation of the
Class type. |
static TypeDescription |
ENUM
A representation of the
Enum type. |
static TypeDescription |
OBJECT
A representation of the
Object type. |
static TypeDescription |
STRING
A representation of the
String type. |
static TypeDescription |
UNDEFINED
Represents any undefined property of a type description that is instead represented as
null in order
to resemble the Java reflection API which returns null and is intuitive to many Java developers. |
static TypeDescription |
VOID
A representation of the
void non-type. |
NON_GENERIC_SIGNATUREEMPTY_NAME, NO_NAMEEMPTY_MASK| Modifier and Type | Method and Description |
|---|---|
int |
getActualModifiers(boolean superFlag)
Returns the type's actual modifiers as present in the class file.
|
String |
getCanonicalName()
Returns the canonical name of this type if it exists.
|
TypeDescription |
getComponentType()
Returns the component type of this type.
|
FieldList<FieldDescription.InDefinedShape> |
getDeclaredFields()
Returns a list of field descriptions that are declared by this type.
|
MethodList<MethodDescription.InDefinedShape> |
getDeclaredMethods()
Returns a list of method descriptions that are declared by this type.
|
TypeList |
getDeclaredTypes()
Returns a list of types that are declared by this type excluding anonymous classes.
|
TypeDescription |
getDeclaringType()
Returns the declaring type of this instance.
|
MethodDescription |
getEnclosingMethod()
Returns a description of the enclosing method of this type.
|
TypeDescription |
getEnclosingType()
Returns a description of the enclosing type of this type.
|
AnnotationList |
getInheritedAnnotations()
Returns the annotations that this type declares or inherits from super types.
|
TypeDescription |
getOwnerType()
Returns the owner type of this type.
|
PackageDescription |
getPackage()
Returns the package internalName of the type described by this instance.
|
String |
getSimpleName()
Returns the simple internalName of this type.
|
boolean |
isAnnotationReturnType()
Checks if instances of this type can be returned from an annotation method.
|
boolean |
isAnnotationValue()
Checks if instances of this type can be used for describing an annotation value.
|
boolean |
isAnnotationValue(Object value)
Checks if instances of this type can be used for describing the given annotation value.
|
boolean |
isAnonymousClass()
Checks if this type description represents an anonymous type.
|
boolean |
isAssignableFrom(Class<?> type)
Checks if this type is assignable from the type described by this instance, for example for
class Foo and class Bar extends Foo, this method would return true for
Foo.class.isAssignableFrom(Bar.class). |
boolean |
isAssignableFrom(TypeDescription typeDescription)
Checks if this type is assignable from the type described by this instance, for example for
class Foo and class Bar extends Foo, this method would return true for
Foo.class.isAssignableFrom(Bar.class). |
boolean |
isAssignableTo(Class<?> type)
Checks if this type is assignable from the type described by this instance, for example for
class Foo and class Bar extends Foo, this method would return true for
Bar.class.isAssignableTo(Foo.class). |
boolean |
isAssignableTo(TypeDescription typeDescription)
Checks if this type is assignable from the type described by this instance, for example for
class Foo and class Bar extends Foo, this method would return true for
Bar.class.isAssignableFrom(Foo.class). |
boolean |
isConstantPool()
Checks if instances of this type can be stored in the constant pool of a class.
|
boolean |
isInstance(Object value)
Checks if
value is an instance of the type represented by this instance. |
boolean |
isInstanceOrWrapper(Object value)
Checks if
value is an instance of the type represented by this instance or a wrapper instance of the
corresponding primitive value. |
boolean |
isLocalClass()
Checks if this type description represents a local type.
|
boolean |
isMemberClass()
Checks if this type description represents a member type.
|
boolean |
isPrimitiveWrapper()
Checks if this type represents a wrapper type for a primitive type.
|
boolean |
isSamePackage(TypeDescription typeDescription)
Checks if two types are defined in the same package.
|
accept, asErasure, getInterfaces, getLowerBounds, getParameters, getSort, getStackSize, getSuperType, getSymbol, getTypeName, getUpperBounds, getVariableSource, isArray, isPrimitive, representsforEach, iterator, spliteratoraccept, findVariable, getEnclosingSource, getTypeVariablesgetDescriptor, getGenericSignature, isVisibleTogetInternalName, getNamegetSourceCodeNamegetModifiers, isAbstract, isAnnotation, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSuper, isSynchronized, isSynthetic, isTransient, isVarArgs, isVolatilegetDeclaredAnnotationsstatic final TypeDescription OBJECT
Object type.static final TypeDescription STRING
String type.static final TypeDescription CLASS
Class type.static final TypeDescription VOID
void non-type.static final TypeDescription ENUM
Enum type.static final int ARRAY_MODIFIERS
static final GenericTypeList ARRAY_INTERFACES
static final TypeDescription UNDEFINED
null in order
to resemble the Java reflection API which returns null and is intuitive to many Java developers.FieldList<FieldDescription.InDefinedShape> getDeclaredFields()
GenericTypeDescriptionReturns a list of field descriptions that are declared by this type. For parameterized types, all type variables of these fields are resolved to the values of the type variables.
Only non-generic types (GenericTypeDescription.Sort.NON_GENERIC) and parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED) define a super type. For a generic array type,
(GenericTypeDescription.Sort.GENERIC_ARRAY), an empty list is returned. For other generic
types, an IllegalStateException is thrown.
getDeclaredFields in interface GenericTypeDescriptionMethodList<MethodDescription.InDefinedShape> getDeclaredMethods()
GenericTypeDescriptionReturns a list of method descriptions that are declared by this type. For parameterized types, all type variables used by these methods are resolved to the values of the type variables.
Only non-generic types (GenericTypeDescription.Sort.NON_GENERIC) and parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED) define a super type. For a generic array type,
(GenericTypeDescription.Sort.GENERIC_ARRAY), an empty list is returned. For other
generic types, an IllegalStateException is thrown.
getDeclaredMethods in interface GenericTypeDescriptionboolean isInstance(Object value)
value is an instance of the type represented by this instance.value - The object of interest.true if the object is an instance of the type described by this instance.boolean isInstanceOrWrapper(Object value)
value is an instance of the type represented by this instance or a wrapper instance of the
corresponding primitive value.value - The object of interest.true if the object is an instance or wrapper of the type described by this instance.boolean isAssignableFrom(Class<?> type)
class Foo and class Bar extends Foo, this method would return true for
Foo.class.isAssignableFrom(Bar.class).type - The type of interest.true if this type is assignable from type.boolean isAssignableFrom(TypeDescription typeDescription)
class Foo and class Bar extends Foo, this method would return true for
Foo.class.isAssignableFrom(Bar.class).
Implementations of this methods are allowed to delegate to
isAssignableFrom(Class)typeDescription - The type of interest.true if this type is assignable from type.boolean isAssignableTo(Class<?> type)
class Foo and class Bar extends Foo, this method would return true for
Bar.class.isAssignableTo(Foo.class).type - The type of interest.true if this type is assignable to type.boolean isAssignableTo(TypeDescription typeDescription)
class Foo and class Bar extends Foo, this method would return true for
Bar.class.isAssignableFrom(Foo.class).
Implementations of this methods are allowed to delegate to
isAssignableTo(Class)typeDescription - The type of interest.true if this type is assignable to type.TypeDescription getComponentType()
GenericTypeDescriptionReturns the component type of this type.
Only non-generic types (GenericTypeDescription.Sort.NON_GENERIC) and generic array types
GenericTypeDescription.Sort.GENERIC_ARRAY) define a component type. For other
types, an IllegalStateException is thrown.
getComponentType in interface GenericTypeDescriptionnull if this type does not represent an array type.TypeDescription getOwnerType()
GenericTypeDescriptionReturns the owner type of this type.
An owner type is only well-defined for parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED) , generic array types
(GenericTypeDescription.Sort.GENERIC_ARRAY) and non-generic types
(GenericTypeDescription.Sort.NON_GENERIC). Non-generic types and generic array types do
never have an owner type. For all other types, this method throws an IllegalStateException.
getOwnerType in interface GenericTypeDescriptionnull if no such owner type exists.TypeDescription getDeclaringType()
DeclaredByTypegetDeclaringType in interface DeclaredByTypenull if no such type exists.TypeList getDeclaredTypes()
MethodDescription getEnclosingMethod()
null if there is no such method.TypeDescription getEnclosingType()
null if there is no such type.int getActualModifiers(boolean superFlag)
Returns the type's actual modifiers as present in the class file. For example, a type cannot be private.
but it modifiers might reflect this property nevertheless if a class was defined as a private inner class.
Unfortunately, the modifier for marking a static class collides with the SUPER modifier such
that these flags are indistinguishable. Therefore, the flag must be specified manually.
superFlag - true if the super flag should be set.String getSimpleName()
String getCanonicalName()
null.boolean isAnonymousClass()
true if this type description represents an anonymous type.boolean isLocalClass()
true if this type description represents a local type.boolean isMemberClass()
true if this type description represents a member type.PackageDescription getPackage()
AnnotationList getInheritedAnnotations()
boolean isSamePackage(TypeDescription typeDescription)
typeDescription - The type of interest.true if this type and the given type are in the same package.boolean isConstantPool()
int cannot be stored in the constant pool as those types are represented
as int values internally.true if instances of this type can be stored in the constant pool of a class.boolean isPrimitiveWrapper()
Void type is
not considered to be a wrapper type.true if this type represents a wrapper type.boolean isAnnotationReturnType()
true if instances of this type can be returned from an annotation method.boolean isAnnotationValue()
true if instances of this type can be used for describing an annotation value.boolean isAnnotationValue(Object value)
value - The value that is supposed to describe the annotation value for this instance.true if instances of this type can be used for describing the given annotation value..Copyright © 2014–2015. All rights reserved.