public abstract static class TypeDescription.AbstractBase extends ModifierReviewable.AbstractBase implements TypeDescription
| Modifier and Type | Class and Description |
|---|---|
static class |
TypeDescription.AbstractBase.OfSimpleType
An adapter implementation of a
TypeDescription that
describes any type that is not an array or a primitive type. |
protected static class |
TypeDescription.AbstractBase.RawTypeWrapper
A visitor that represents all
TypeDescription instances as raw generic types. |
TypeDescription.AbstractBase, TypeDescription.ArrayProjection, TypeDescription.ForLoadedType, TypeDescription.ForPackageDescription, TypeDescription.LatentGenericTypeDescription.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.WithRuntimeNameARRAY_INTERFACES, ARRAY_MODIFIERS, CLASS, ENUM, OBJECT, STRING, UNDEFINED, VOIDNON_GENERIC_SIGNATUREEMPTY_NAME, NO_NAMEEMPTY_MASK| Constructor and Description |
|---|
AbstractBase() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
accept(GenericTypeDescription.Visitor<T> visitor)
Applies a visitor to this generic type description.
|
<T> T |
accept(TypeVariableSource.Visitor<T> visitor)
Applies a visitor on this type variable source.
|
TypeDescription |
asErasure()
Returns the erasure of this type.
|
boolean |
equals(Object other) |
GenericTypeDescription |
findVariable(String symbol)
Finds a particular variable with the given name in the closes type variable source that is visible from this instance.
|
int |
getActualModifiers(boolean superFlag)
Returns the type's actual modifiers as present in the class file.
|
protected abstract GenericTypeList |
getDeclaredInterfaces()
Returns the declared interface types in the form they are declared in the class file.
|
protected abstract GenericTypeDescription |
getDeclaredSuperType()
Returns the declared super type in the form it is declared in the class file.
|
TypeVariableSource |
getEnclosingSource()
Returns the enclosing source of type variables that are valid in the scope of this type variable source.
|
String |
getGenericSignature()
Returns the generic signature of this byte code element.
|
AnnotationList |
getInheritedAnnotations()
Returns the annotations that this type declares or inherits from super types.
|
GenericTypeList |
getInterfaces()
Returns the generic interface types of this type.
|
String |
getInternalName()
Returns the internal internalName of this byte code element.
|
GenericTypeList |
getLowerBounds()
Returns the lower bounds of this type.
|
TypeDescription |
getOwnerType()
Returns the owner type of this type.
|
GenericTypeList |
getParameters()
Returns the type parameters of this type.
|
GenericTypeDescription.Sort |
getSort()
Returns the sort of the generic type this instance represents.
|
String |
getSourceCodeName()
Returns the name of this element as it is found in the source code.
|
GenericTypeDescription |
getSuperType()
Returns the generic super type of this type.
|
String |
getSymbol()
Returns the symbol of this type variable.
|
String |
getTypeName()
Returns the name of the type.
|
GenericTypeList |
getUpperBounds()
Returns the upper bounds of this type.
|
TypeVariableSource |
getVariableSource()
Returns the source of this type variable.
|
int |
hashCode() |
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 |
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 |
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.
|
boolean |
isVisibleTo(TypeDescription typeDescription)
Checks if this element is visible from a given type.
|
Iterator<GenericTypeDescription> |
iterator() |
boolean |
represents(Type type)
Checks if the type described by this instance represents
type. |
String |
toString() |
isAbstract, isAnnotation, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSuper, isSynchronized, isSynthetic, isTransient, isVarArgs, isVolatileclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetCanonicalName, getComponentType, getDeclaredFields, getDeclaredMethods, getDeclaredTypes, getDeclaringType, getEnclosingMethod, getEnclosingType, getPackage, getSimpleName, isAnonymousClass, isLocalClass, isMemberClassgetStackSize, isArray, isPrimitiveforEach, spliteratorgetTypeVariablesgetDescriptorgetNamegetModifiers, isAbstract, isAnnotation, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSuper, isSynchronized, isSynthetic, isTransient, isVarArgs, isVolatilegetDeclaredAnnotationspublic GenericTypeDescription getSuperType()
GenericTypeDescriptionReturns the generic super type of this type.
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), a description of Object is returned.
For other generic types, an IllegalStateException is thrown.
getSuperType in interface GenericTypeDescriptionnull if no such type exists.protected abstract GenericTypeDescription getDeclaredSuperType()
public GenericTypeList getInterfaces()
GenericTypeDescriptionReturns the generic interface types of this type.
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), a list of Serializable and
Cloneable) is returned. For other generic types, an IllegalStateException is thrown.
getInterfaces in interface GenericTypeDescriptionprotected abstract GenericTypeList getDeclaredInterfaces()
public boolean isAssignableFrom(Class<?> type)
TypeDescriptionclass Foo and class Bar extends Foo, this method would return true for
Foo.class.isAssignableFrom(Bar.class).isAssignableFrom in interface TypeDescriptiontype - The type of interest.true if this type is assignable from type.public boolean isAssignableFrom(TypeDescription typeDescription)
TypeDescriptionclass 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
TypeDescription.isAssignableFrom(Class)isAssignableFrom in interface TypeDescriptiontypeDescription - The type of interest.true if this type is assignable from type.public boolean isAssignableTo(Class<?> type)
TypeDescriptionclass Foo and class Bar extends Foo, this method would return true for
Bar.class.isAssignableTo(Foo.class).isAssignableTo in interface TypeDescriptiontype - The type of interest.true if this type is assignable to type.public boolean isAssignableTo(TypeDescription typeDescription)
TypeDescriptionclass 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
TypeDescription.isAssignableTo(Class)isAssignableTo in interface TypeDescriptiontypeDescription - The type of interest.true if this type is assignable to type.public GenericTypeDescription.Sort getSort()
GenericTypeDescriptiongetSort in interface GenericTypeDescriptionpublic TypeDescription asErasure()
GenericTypeDescriptionGenericTypeDescription.Sort.WILDCARD)
do not have a well-defined erasure and cause an IllegalStateException to be thrown.asErasure in interface GenericTypeDescriptionpublic GenericTypeList getUpperBounds()
GenericTypeDescription
Returns the upper bounds of this type. Any type with a well-defined upper bound is bound by at least one type. If no such
type is defined, the bound is implicitly Object.
Only non-symbolic type variables (GenericTypeDescription.Sort.VARIABLE,
GenericTypeDescription.Sort.VARIABLE_DETACHED) and wildcard types
(GenericTypeDescription.Sort.WILDCARD) have well-defined upper bounds. For other
types, an IllegalStateException is thrown.
getUpperBounds in interface GenericTypeDescriptionpublic GenericTypeList getLowerBounds()
GenericTypeDescriptionReturns the lower bounds of this type.
Only wildcard types (GenericTypeDescription.Sort.WILDCARD) define a lower bound. For other
types, an IllegalStateException is thrown.
getLowerBounds in interface GenericTypeDescriptionpublic GenericTypeList getParameters()
GenericTypeDescriptionReturns the type parameters of this type.
Parameters are only well-defined for parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED), generic array types
(GenericTypeDescription.Sort.GENERIC_ARRAY) and non-generic types
(GenericTypeDescription.Sort.NON_GENERIC). For non-generic and generic array types,
the returned list is always empty. For all other types, this method throws an IllegalStateException.
getParameters in interface GenericTypeDescriptionpublic String getSymbol()
GenericTypeDescriptionGenericTypeDescription.Sort.VARIABLE,
GenericTypeDescription.Sort.VARIABLE_DETACHED,
GenericTypeDescription.Sort.VARIABLE_SYMBOLIC). For other types, this method
throws an IllegalStateException.getSymbol in interface GenericTypeDescriptionpublic 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 GenericTypeDescriptiongetOwnerType in interface TypeDescriptionnull if no such owner type exists.public boolean isInstance(Object value)
TypeDescriptionvalue is an instance of the type represented by this instance.isInstance in interface TypeDescriptionvalue - The object of interest.true if the object is an instance of the type described by this instance.public boolean isInstanceOrWrapper(Object value)
TypeDescriptionvalue is an instance of the type represented by this instance or a wrapper instance of the
corresponding primitive value.isInstanceOrWrapper in interface TypeDescriptionvalue - The object of interest.true if the object is an instance or wrapper of the type described by this instance.public boolean isAnnotationValue(Object value)
TypeDescriptionisAnnotationValue in interface TypeDescriptionvalue - 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..public String getInternalName()
NamedElement.WithRuntimeNamegetInternalName in interface NamedElement.WithRuntimeNamepublic int getActualModifiers(boolean superFlag)
TypeDescription
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.
getActualModifiers in interface TypeDescriptionsuperFlag - true if the super flag should be set.public String getGenericSignature()
ByteCodeElementnull is returned as a signature.getGenericSignature in interface ByteCodeElementnull if this element is not generic.public TypeVariableSource getVariableSource()
GenericTypeDescriptionGenericTypeDescription.Sort.VARIABLE. For other types, this method
throws an IllegalStateException.getVariableSource in interface GenericTypeDescriptionpublic boolean isSamePackage(TypeDescription typeDescription)
TypeDescriptionisSamePackage in interface TypeDescriptiontypeDescription - The type of interest.true if this type and the given type are in the same package.public boolean isVisibleTo(TypeDescription typeDescription)
ByteCodeElementChecks if this element is visible from a given type.
Note: A method or field might define a signature that includes types that are not visible to a type. Such methods can be legally invoked from this type and can even be implemented as bridge methods by this type. It is however not legal to declare a method with invisible types in its signature that are not bridges what might require additional validation.
Important: Virtual byte code elements, i.e. virtual methods, are only considered visible if the type they are invoked upon is visible to a given type. The visibility of such virtual members can therefore not be determined by only investigating the invoked method but requires an additional check of the target type.
isVisibleTo in interface ByteCodeElementtypeDescription - The type which is checked for its access of this element.true if this element is visible for typeDescription.public AnnotationList getInheritedAnnotations()
TypeDescriptiongetInheritedAnnotations in interface TypeDescriptionpublic String getSourceCodeName()
NamedElementgetSourceCodeName in interface NamedElementpublic boolean isConstantPool()
TypeDescriptionint cannot be stored in the constant pool as those types are represented
as int values internally.isConstantPool in interface TypeDescriptiontrue if instances of this type can be stored in the constant pool of a class.public boolean isPrimitiveWrapper()
TypeDescriptionVoid type is
not considered to be a wrapper type.isPrimitiveWrapper in interface TypeDescriptiontrue if this type represents a wrapper type.public boolean isAnnotationReturnType()
TypeDescriptionisAnnotationReturnType in interface TypeDescriptiontrue if instances of this type can be returned from an annotation method.public boolean isAnnotationValue()
TypeDescriptionisAnnotationValue in interface TypeDescriptiontrue if instances of this type can be used for describing an annotation value.public boolean represents(Type type)
GenericTypeDescriptiontype.represents in interface GenericTypeDescriptiontype - The type of interest.true if the type described by this instance represents type.public String getTypeName()
GenericTypeDescriptionObject.toString() representations. For a non-generic
type, it is the fully qualified binary name of the type.getTypeName in interface GenericTypeDescriptionpublic TypeVariableSource getEnclosingSource()
TypeVariableSourcegetEnclosingSource in interface TypeVariableSourcenull if no such source exists.public GenericTypeDescription findVariable(String symbol)
TypeVariableSourcefindVariable in interface TypeVariableSourcesymbol - The symbolic name of the type variable.public <T> T accept(TypeVariableSource.Visitor<T> visitor)
TypeVariableSourceaccept in interface TypeVariableSourceT - The visitor's return type.visitor - The visitor to apply.public <T> T accept(GenericTypeDescription.Visitor<T> visitor)
GenericTypeDescriptionaccept in interface GenericTypeDescriptionT - The value that this visitor yields.visitor - The visitor to apply.public Iterator<GenericTypeDescription> iterator()
iterator in interface Iterable<GenericTypeDescription>Copyright © 2014–2015. All rights reserved.