public abstract static class TypeDescription.AbstractBase extends TypeVariableSource.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. |
TypeDescription.AbstractBase, TypeDescription.ArrayProjection, TypeDescription.ForLoadedType, TypeDescription.ForPackageDescription, TypeDescription.Generic, TypeDescription.Latent, TypeDescription.SuperTypeLoadingTypeDefinition.Sort, TypeDefinition.SuperClassIteratorModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumerationByteCodeElement.Token<T extends ByteCodeElement.Token<T>>, ByteCodeElement.TypeDependant<T extends ByteCodeElement.TypeDependant<?,S>,S extends ByteCodeElement.Token<S>>NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeNameAnnotationSource.Empty, AnnotationSource.ExplicitTypeVariableSource.Visitor<T>| Modifier and Type | Field and Description |
|---|---|
static boolean |
RAW_TYPES
The
TypeDefinition.RAW_TYPES_PROPERTY property. |
ARRAY_INTERFACES, CLASS, OBJECT, STRING, THROWABLE, UNDEFINED, VOIDRAW_TYPES_PROPERTYEMPTY_MASKNON_GENERIC_SIGNATUREEMPTY_NAME, NO_NAME| Constructor and Description |
|---|
AbstractBase() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
accept(TypeVariableSource.Visitor<T> visitor)
Applies a visitor on this type variable source.
|
TypeDescription |
asBoxed()
Returns a description of this type that represents this type as a boxed type for primitive types, unless its
void. |
TypeDescription |
asErasure()
Returns the erasure of this type.
|
TypeDescription.Generic |
asGenericType()
Returns this type definition as a generic type.
|
TypeDescription |
asUnboxed()
Returns a description of this type that represents this type as an unboxed type for boxing types, unless its
Void. |
boolean |
equals(Object other) |
int |
getActualModifiers(boolean superFlag)
Returns the type's actual modifiers as present in the class file.
|
String |
getActualName()
Returns the name of this element as it is found in the source code.
|
Object |
getDefaultValue()
Returns the default value for this type, i.e.
|
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.
|
int |
getInnerClassCount()
Returns the amount of outer classes this type defines.
|
String |
getInternalName()
Returns the internal internalName of this byte code element.
|
TypeDefinition.Sort |
getSort()
Returns the sort of the generic type this instance represents.
|
String |
getTypeName()
Returns the name of the type.
|
int |
hashCode() |
boolean |
isAccessibleTo(TypeDescription typeDescription)
Checks if this element is accessible from a given 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 |
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 |
isGenerified()
Checks if this type variable source has a generic declaration.
|
boolean |
isInferrable()
Returns
true if type variables declared by this type variable source allow dynamic type inference. |
boolean |
isInHierarchyWith(Class<?> type)
Returns
true if this type and the supplied type are in a type hierarchy with each other, i.e. |
boolean |
isInHierarchyWith(TypeDescription typeDescription)
Returns
true if this type and the supplied type are in a type hierarchy with each other, i.e. |
boolean |
isInnerClass()
Indicates if this class is an inner class.
|
boolean |
isInstance(Object value)
Checks if
value is an instance of the type represented by this instance. |
boolean |
isMemberType()
Checks if this type description represents a member type.
|
boolean |
isNestedClass()
Indicates if this class is a nested class.
|
boolean |
isNestHost()
Checks if this class is the host of a nest group.
|
boolean |
isNestMateOf(Class<?> type)
Checks if this type and the supplied type are members of the same nest group.
|
boolean |
isNestMateOf(TypeDescription typeDescription)
Checks if this type and the supplied type are members of the same nest group.
|
boolean |
isPackageType()
Checks if this type represents a class that is a place holder for a package description.
|
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<TypeDefinition> |
iterator() |
boolean |
represents(Type type)
Checks if the type described by this instance represents
type. |
String |
toString() |
findVariablegetEnumerationState, getFieldManifestation, getFieldPersistence, getMethodManifestation, getMethodStrictness, getOwnership, getParameterManifestation, getProvisioningState, getSynchronizationState, getSyntheticState, getTypeManifestation, getVisibility, isAbstract, isAnnotation, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isSynthetic, isTransient, isVarArgs, isVolatileclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetCanonicalName, getComponentType, getDeclaredFields, getDeclaredMethods, getDeclaredTypes, getDeclaringType, getEnclosingMethod, getEnclosingType, getNestHost, getNestMembers, getPackage, getSimpleName, isAnonymousType, isLocalTypegetInterfaces, getStackSize, getSuperClass, isArray, isPrimitivegetTypeManifestation, isAnnotation, isInterfaceisAbstractgetEnumerationState, isEnumgetOwnership, getVisibility, isDeprecated, isPackagePrivate, isPrivate, isProtected, isPublic, isStaticgetModifiers, getSyntheticState, isFinal, isSyntheticforEach, spliteratorgetDescriptorgetNamegetDeclaredAnnotationsfindVariable, getTypeVariablespublic static final boolean RAW_TYPES
TypeDefinition.RAW_TYPES_PROPERTY property.public boolean isAssignableFrom(Class<?> type)
class 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)
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
TypeDescription.isAssignableFrom(Class)isAssignableFrom in interface TypeDescriptiontypeDescription - The type of interest.true if this type is assignable from type.public boolean isAssignableTo(Class<?> type)
class 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)
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
TypeDescription.isAssignableTo(Class)isAssignableTo in interface TypeDescriptiontypeDescription - The type of interest.true if this type is assignable to type.public boolean isInHierarchyWith(Class<?> type)
true if this type and the supplied type are in a type hierarchy with each other, i.e. if this type is assignable
to the supplied type or the other way around.isInHierarchyWith in interface TypeDescriptiontype - The type of interest.true if this type and the supplied type are in a type hierarchy with each other.public boolean isInHierarchyWith(TypeDescription typeDescription)
true if this type and the supplied type are in a type hierarchy with each other, i.e. if this type is assignable
to the supplied type or the other way around.isInHierarchyWith in interface TypeDescriptiontypeDescription - The type of interest.true if this type and the supplied type are in a type hierarchy with each other.public TypeDescription asErasure()
TypeDescription.Generic.Sort#WILDCARD)
do not have a well-defined erasure and cause an IllegalStateException to be thrown.asErasure in interface TypeDefinitionpublic TypeDescription.Generic asGenericType()
asGenericType in interface TypeDefinitionpublic TypeDefinition.Sort getSort()
getSort in interface TypeDefinitionpublic boolean isInstance(Object value)
value 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 isAnnotationValue(Object value)
isAnnotationValue 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()
getInternalName in interface NamedElement.WithRuntimeNamepublic int getActualModifiers(boolean superFlag)
private.
but it modifiers might reflect this property nevertheless if a class was defined as a private inner class. The
returned modifiers take also into account if the type is marked as Deprecated. Anonymous classes that are
enclosed in a static method or the type initializer are additionally marked as final as it is also done
by the Java compiler.getActualModifiers in interface TypeDescriptionsuperFlag - true if the modifier's super flag should be set.public String getGenericSignature()
null is returned as a signature.getGenericSignature in interface ByteCodeElementnull if this element is not generic.public boolean isSamePackage(TypeDescription typeDescription)
isSamePackage 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)
Checks if this element is visible from a given type. Visibility is a wider criteria then accessibility which can be checked by
ByteCodeElement.isAccessibleTo(TypeDescription). Visibility allows the invocation of a method on itself or on external
instances.
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 visibility of this element.true if this element is visible for typeDescription.public boolean isAccessibleTo(TypeDescription typeDescription)
Checks if this element is accessible from a given type. Accessibility is a more narrow criteria then visibility which can be
checked by ByteCodeElement.isVisibleTo(TypeDescription). Accessibility allows the invocation of a method on external
instances or on itself. Methods that can be invoked from within an instance might however not be considered accessible.
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.
isAccessibleTo in interface ByteCodeElementtypeDescription - The type which is checked for its accessibility of this element.true if this element is accessible for typeDescription.public AnnotationList getInheritedAnnotations()
getInheritedAnnotations in interface TypeDescriptionpublic String getActualName()
getActualName in interface NamedElementpublic boolean isPrimitiveWrapper()
Void type is
not considered to be a wrapper type.isPrimitiveWrapper in interface TypeDescriptiontrue if this type represents a wrapper type.public boolean isAnnotationReturnType()
isAnnotationReturnType in interface TypeDescriptiontrue if instances of this type can be returned from an annotation method.public boolean isAnnotationValue()
isAnnotationValue in interface TypeDescriptiontrue if instances of this type can be used for describing an annotation value.public boolean represents(Type type)
type.represents in interface TypeDefinitiontype - The type of interest.true if the type described by this instance represents type.public String getTypeName()
Object.toString() representations. For a non-generic
type, it is the fully qualified binary name of the type.getTypeName in interface TypeDefinitionpublic TypeVariableSource getEnclosingSource()
getEnclosingSource in interface TypeVariableSourcenull if no such source exists.public boolean isInferrable()
true if type variables declared by this type variable source allow dynamic type inference.isInferrable in interface TypeVariableSourcetrue if type variables declared by this type variable source allow dynamic type inference.public <T> T accept(TypeVariableSource.Visitor<T> visitor)
accept in interface TypeVariableSourceT - The visitor's return type.visitor - The visitor to apply.public boolean isPackageType()
isPackageType in interface TypeDescriptiontrue if this type represents a package description.public boolean isGenerified()
isGenerified in interface TypeVariableSourcetrue if this type code element has a generic declaration.public int getInnerClassCount()
0 is returned.getInnerClassCount in interface TypeDescriptionpublic boolean isInnerClass()
isInnerClass in interface TypeDescriptiontrue if this class is an inner class.public boolean isNestedClass()
isNestedClass in interface TypeDescriptiontrue if this class is a nested class.public TypeDescription asBoxed()
void.asBoxed in interface TypeDescriptionpublic TypeDescription asUnboxed()
Void.asUnboxed in interface TypeDescriptionpublic Object getDefaultValue()
null for a reference type.
For void, null is returned.getDefaultValue in interface TypeDescriptionpublic boolean isNestHost()
isNestHost in interface TypeDescriptiontrue if this class is a nest group's host.public boolean isNestMateOf(Class<?> type)
isNestMateOf in interface TypeDescriptiontype - The type for which to check if it is a member of the same nest group.true if this type and the supplied type are members of the same nest group.public boolean isNestMateOf(TypeDescription typeDescription)
isNestMateOf in interface TypeDescriptiontypeDescription - The type for which to check if it is a member of the same nest group.true if this type and the supplied type are members of the same nest group.public boolean isMemberType()
isMemberType in interface TypeDescriptiontrue if this type description represents a member type.public Iterator<TypeDefinition> iterator()
iterator in interface Iterable<TypeDefinition>Copyright © 2014–2019. All rights reserved.