public static class TypeDescription.ForLoadedType extends TypeDescription.AbstractBase implements Serializable
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
TypeDescription.ForLoadedType.Dispatcher
A dispatcher for using methods of
Class that are not declared for Java 6. |
TypeDescription.AbstractBase.OfSimpleTypeTypeDescription.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>RAW_TYPESARRAY_INTERFACES, CLASS, OBJECT, STRING, THROWABLE, UNDEFINED, VOIDRAW_TYPES_PROPERTYEMPTY_MASKNON_GENERIC_SIGNATUREEMPTY_NAME, NO_NAME| Constructor and Description |
|---|
ForLoadedType(Class<?> type)
Creates a new immutable type description for a loaded type.
|
| Modifier and Type | Method and Description |
|---|---|
TypeDescription.Generic |
asGenericType()
Returns this type definition as a generic type.
|
String |
getCanonicalName()
Returns the canonical name of this type if it exists.
|
TypeDescription |
getComponentType()
Returns the component type of this type.
|
AnnotationList |
getDeclaredAnnotations()
Returns a list of annotations that are declared by this instance.
|
FieldList<FieldDescription.InDefinedShape> |
getDeclaredFields()
Returns the fields that this type declares.
|
MethodList<MethodDescription.InDefinedShape> |
getDeclaredMethods()
Returns the methods that this type declares.
|
TypeList |
getDeclaredTypes()
Returns a list of types that are declared by this type.
|
TypeDescription |
getDeclaringType()
Returns the declaring type of this instance.
|
String |
getDescriptor()
Returns the descriptor of this byte code element.
|
MethodDescription.InDefinedShape |
getEnclosingMethod()
Returns a description of the method that encloses this type.
|
TypeDescription |
getEnclosingType()
Returns a description of this type's enclosing type if any.
|
TypeList.Generic |
getInterfaces()
Returns the interfaces that this type implements.
|
int |
getModifiers()
Returns the modifier that is described by this object.
|
String |
getName()
Returns the internalName of this byte code element.
|
static String |
getName(Class<?> type)
Returns the type's actual name where it is taken into consideration that this type might be loaded anonymously.
|
TypeDescription |
getNestHost()
Returns the nest host of this type.
|
TypeList |
getNestMembers()
Returns a list of members that are part of a nesting group.
|
PackageDescription |
getPackage()
Returns the package of the type described by this instance or
null if the described type does not imply a package. |
String |
getSimpleName()
Returns the simple internalName of this type.
|
StackSize |
getStackSize()
Returns the size of the type described by this instance.
|
TypeDescription.Generic |
getSuperClass()
Returns the super class of this type.
|
TypeList.Generic |
getTypeVariables()
Returns the type variables that are declared by this element.
|
boolean |
isAnnotation()
Specifies if the modifier described by this object represents the annotation flag.
|
boolean |
isAnonymousType()
Checks if this type description represents an anonymous type.
|
boolean |
isArray()
Checks if the type described by this entity is an array.
|
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 |
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 |
isLocalType()
Checks if this type description represents a local type.
|
boolean |
isMemberType()
Checks if this type description represents a member type.
|
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 |
isPrimitive()
Checks if the type described by this entity is a primitive type.
|
static TypeDescription |
of(Class<?> type)
Returns a new immutable type description for a loaded type.
|
boolean |
represents(Type type)
Checks if the type described by this instance represents
type. |
accept, asBoxed, asErasure, asUnboxed, equals, getActualModifiers, getActualName, getDefaultValue, getEnclosingSource, getGenericSignature, getInheritedAnnotations, getInnerClassCount, getInternalName, getSort, getTypeName, hashCode, isAccessibleTo, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isGenerified, isInnerClass, isInstance, isNestedClass, isPackageType, isPrimitiveWrapper, isSamePackage, isVisibleTo, iterator, toStringfindVariablegetEnumerationState, getFieldManifestation, getFieldPersistence, getMethodManifestation, getMethodStrictness, getOwnership, getParameterManifestation, getProvisioningState, getSynchronizationState, getSyntheticState, getTypeManifestation, getVisibility, isAbstract, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isSynthetic, isTransient, isVarArgs, isVolatileclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetTypeManifestation, isInterfaceisAbstractgetEnumerationState, isEnumgetOwnership, getVisibility, isDeprecated, isPackagePrivate, isPrivate, isProtected, isPublic, isStaticgetSyntheticState, isFinal, isSyntheticforEach, spliteratorfindVariablepublic ForLoadedType(Class<?> type)
TypeDescription.Generic.OfNonGenericType.ForLoadedType.of(Class) instead.type - The type to be represented by this type description.public static String getName(Class<?> type)
/<id> which is removed when using this method
but is retained when calling Class.getName().type - The type for which to resolve its name.public static TypeDescription of(Class<?> type)
type - The type to be represented by this type description.public boolean isAssignableFrom(Class<?> type)
TypeDescription.AbstractBaseclass Foo and class Bar extends Foo, this method would return true for
Foo.class.isAssignableFrom(Bar.class).isAssignableFrom in interface TypeDescriptionisAssignableFrom in class TypeDescription.AbstractBasetype - The type of interest.true if this type is assignable from type.public boolean isAssignableFrom(TypeDescription typeDescription)
TypeDescription.AbstractBaseclass 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 TypeDescriptionisAssignableFrom in class TypeDescription.AbstractBasetypeDescription - The type of interest.true if this type is assignable from type.public boolean isAssignableTo(Class<?> type)
TypeDescription.AbstractBaseclass Foo and class Bar extends Foo, this method would return true for
Bar.class.isAssignableTo(Foo.class).isAssignableTo in interface TypeDescriptionisAssignableTo in class TypeDescription.AbstractBasetype - The type of interest.true if this type is assignable to type.public boolean isAssignableTo(TypeDescription typeDescription)
TypeDescription.AbstractBaseclass 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 TypeDescriptionisAssignableTo in class TypeDescription.AbstractBasetypeDescription - The type of interest.true if this type is assignable to type.public boolean isInHierarchyWith(Class<?> type)
TypeDescription.AbstractBasetrue 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 TypeDescriptionisInHierarchyWith in class TypeDescription.AbstractBasetype - 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)
TypeDescription.AbstractBasetrue 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 TypeDescriptionisInHierarchyWith in class TypeDescription.AbstractBasetypeDescription - The type of interest.true if this type and the supplied type are in a type hierarchy with each other.public boolean represents(Type type)
TypeDescription.AbstractBasetype.represents in interface TypeDefinitionrepresents in class TypeDescription.AbstractBasetype - The type of interest.true if the type described by this instance represents type.public TypeDescription getComponentType()
Returns the component type of this type.
Only non-generic types (TypeDescription.Generic.Sort#NON_GENERIC) and generic array types
TypeDescription.Generic.Sort#GENERIC_ARRAY) define a component type. For other
types, an IllegalStateException is thrown.
getComponentType in interface TypeDefinitiongetComponentType in interface TypeDescriptionnull if this type does not represent an array type.public boolean isArray()
isArray in interface TypeDefinitiontrue if this type description represents an array.public boolean isPrimitive()
isPrimitive in interface TypeDefinitiontrue if this type description represents a primitive type.public boolean isAnnotation()
ModifierReviewable.AbstractBaseisAnnotation in interface ModifierReviewable.ForTypeDefinitionisAnnotation in class ModifierReviewable.AbstractBasetrue if the modifier described by this object represents the annotation flag.public TypeDescription.Generic getSuperClass()
TypeDefinition.Sort.NON_GENERIC),
parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types. Interface types
and the Object class do not define a super class where null is returned. Array types define Object
as their direct super class.getSuperClass in interface TypeDefinitionnull if no super class exists for this type.public TypeList.Generic getInterfaces()
TypeDefinition.Sort.NON_GENERIC),
parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types.getInterfaces in interface TypeDefinitionpublic TypeDescription getDeclaringType()
getDeclaringType in interface DeclaredByTypegetDeclaringType in interface TypeDescriptionnull if no such type exists.public MethodDescription.InDefinedShape getEnclosingMethod()
null is returned by this method.getEnclosingMethod in interface TypeDescriptionnull if there is no such method.public TypeDescription getEnclosingType()
getEnclosingType in interface TypeDescriptionnull if there is no such type.public TypeList getDeclaredTypes()
getDeclaredTypes in interface TypeDescriptionpublic String getSimpleName()
getSimpleName in interface TypeDescriptionpublic boolean isAnonymousType()
isAnonymousType in interface TypeDescriptiontrue if this type description represents an anonymous type.public boolean isLocalType()
isLocalType in interface TypeDescriptiontrue if this type description represents a local type.public boolean isMemberType()
TypeDescription.AbstractBaseisMemberType in interface TypeDescriptionisMemberType in class TypeDescription.AbstractBasetrue if this type description represents a member type.@CachedReturnPlugin.Enhance(value="declaredFields") public FieldList<FieldDescription.InDefinedShape> getDeclaredFields()
TypeDefinition.Sort.NON_GENERIC),
parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types. Generic array
types never define fields and the returned list is always empty for such types.getDeclaredFields in interface TypeDefinitiongetDeclaredFields in interface TypeDescriptionTypeDefinition.Sort.NON_GENERIC),
parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types. Generic array
types never define methods and the returned list is always empty for such types.@CachedReturnPlugin.Enhance(value="declaredMethods") public MethodList<MethodDescription.InDefinedShape> getDeclaredMethods()
getDeclaredMethods in interface TypeDefinitiongetDeclaredMethods in interface TypeDescriptionpublic PackageDescription getPackage()
null if the described type does not imply a package.getPackage in interface TypeDescriptionnull if the described type does not imply a package.public StackSize getStackSize()
TypeDescription.Generic.Sort#WILDCARD do not have a well-defined a stack size and
cause an IllegalStateException to be thrown.getStackSize in interface TypeDefinitionpublic String getName()
getName in interface NamedElement.WithRuntimeNamepublic String getCanonicalName()
getCanonicalName in interface TypeDescriptionnull.public String getDescriptor()
getDescriptor in interface ByteCodeElementpublic int getModifiers()
getModifiers in interface ModifierReviewablepublic TypeList.Generic getTypeVariables()
getTypeVariables in interface TypeVariableSource@CachedReturnPlugin.Enhance(value="declaredAnnotations") public AnnotationList getDeclaredAnnotations()
getDeclaredAnnotations in interface AnnotationSourcepublic TypeDescription.Generic asGenericType()
asGenericType in interface TypeDefinitionasGenericType in class TypeDescription.AbstractBasepublic TypeDescription getNestHost()
getNestHost in interface TypeDescriptionpublic TypeList getNestMembers()
getNestMembers in interface TypeDescriptionpublic boolean isNestHost()
TypeDescription.AbstractBaseisNestHost in interface TypeDescriptionisNestHost in class TypeDescription.AbstractBasetrue if this class is a nest group's host.public boolean isNestMateOf(Class<?> type)
TypeDescription.AbstractBaseisNestMateOf in interface TypeDescriptionisNestMateOf in class TypeDescription.AbstractBasetype - 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)
TypeDescription.AbstractBaseisNestMateOf in interface TypeDescriptionisNestMateOf in class TypeDescription.AbstractBasetypeDescription - 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.Copyright © 2014–2019. All rights reserved.