Package net.bytebuddy.description.type
Class TypeDescription.ForLoadedType
- java.lang.Object
-
- net.bytebuddy.description.ModifierReviewable.AbstractBase
-
- net.bytebuddy.description.TypeVariableSource.AbstractBase
-
- net.bytebuddy.description.type.TypeDescription.AbstractBase
-
- net.bytebuddy.description.type.TypeDescription.ForLoadedType
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<TypeDefinition>,AnnotationSource,ByteCodeElement,DeclaredByType,ModifierReviewable,ModifierReviewable.ForFieldDescription,ModifierReviewable.ForMethodDescription,ModifierReviewable.ForParameterDescription,ModifierReviewable.ForTypeDefinition,ModifierReviewable.OfAbstraction,ModifierReviewable.OfByteCodeElement,ModifierReviewable.OfEnumeration,NamedElement,NamedElement.WithRuntimeName,TypeDefinition,TypeDescription,TypeVariableSource
- Enclosing interface:
- TypeDescription
public static class TypeDescription.ForLoadedType extends TypeDescription.AbstractBase implements java.io.Serializable
A type description implementation that represents a loaded type.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.bytebuddy.description.type.TypeDescription.AbstractBase
TypeDescription.AbstractBase.OfSimpleType
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.annotation.AnnotationSource
AnnotationSource.Empty, AnnotationSource.Explicit
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.ByteCodeElement
ByteCodeElement.Token<T extends ByteCodeElement.Token<T>>, ByteCodeElement.TypeDependant<T extends ByteCodeElement.TypeDependant<?,S>,S extends ByteCodeElement.Token<S>>
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.ModifierReviewable
ModifierReviewable.AbstractBase, ModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumeration
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.NamedElement
NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeName
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.type.TypeDefinition
TypeDefinition.Sort, TypeDefinition.SuperClassIterator
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.type.TypeDescription
TypeDescription.AbstractBase, TypeDescription.ArrayProjection, TypeDescription.ForLoadedType, TypeDescription.ForPackageDescription, TypeDescription.Generic, TypeDescription.Latent, TypeDescription.SuperTypeLoading
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.TypeVariableSource
TypeVariableSource.AbstractBase, TypeVariableSource.Visitor<T>
-
-
Field Summary
-
Fields inherited from class net.bytebuddy.description.type.TypeDescription.AbstractBase
RAW_TYPES
-
Fields inherited from interface net.bytebuddy.description.ByteCodeElement
NON_GENERIC_SIGNATURE
-
Fields inherited from interface net.bytebuddy.description.ModifierReviewable
EMPTY_MASK
-
Fields inherited from interface net.bytebuddy.description.NamedElement
EMPTY_NAME, NO_NAME
-
Fields inherited from interface net.bytebuddy.description.type.TypeDefinition
RAW_TYPES_PROPERTY
-
Fields inherited from interface net.bytebuddy.description.type.TypeDescription
ARRAY_INTERFACES, CLASS, OBJECT, STRING, THROWABLE, UNDEFINED, VOID
-
Fields inherited from interface net.bytebuddy.description.TypeVariableSource
UNDEFINED
-
-
Constructor Summary
Constructors Constructor Description ForLoadedType(java.lang.Class<?> type)Creates a new immutable type description for a loaded type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCanonicalName()Returns the canonical name of this type if it exists.TypeDescriptiongetComponentType()Returns the component type of this type.AnnotationListgetDeclaredAnnotations()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.TypeListgetDeclaredTypes()Returns a list of types that are declared by this type excluding anonymous classes.TypeDescriptiongetDeclaringType()Returns the declaring type of this instance.java.lang.StringgetDescriptor()Returns the descriptor of this byte code element.MethodDescriptiongetEnclosingMethod()Returns a description of the method that encloses this type.TypeDescriptiongetEnclosingType()Returns a description of this type's enclosing type if any.TypeList.GenericgetInterfaces()Returns the interfaces that this type implements.intgetModifiers()Returns the modifier that is described by this object.java.lang.StringgetName()Returns the internalName of this byte code element.static java.lang.StringgetName(java.lang.Class<?> type)Returns the type's actual name where it is taken into consideration that this type might be loaded anonymously.PackageDescriptiongetPackage()Returns the package internalName of the type described by this instance.java.lang.StringgetSimpleName()Returns the simple internalName of this type.StackSizegetStackSize()Returns the size of the type described by this instance.TypeDescription.GenericgetSuperClass()Returns the super class of this type.TypeList.GenericgetTypeVariables()Returns the type variables that are declared by this element.booleanisAnnotation()Specifies if the modifier described by this object represents the annotation flag.booleanisAnonymousClass()Checks if this type description represents an anonymous type.booleanisArray()Checks if the type described by this entity is an array.booleanisAssignableFrom(java.lang.Class<?> type)Checks if this type is assignable from the type described by this instance, for example forclass Fooandclass Bar extends Foo, this method would returntrueforFoo.class.isAssignableFrom(Bar.class).booleanisAssignableTo(java.lang.Class<?> type)Checks if this type is assignable from the type described by this instance, for example forclass Fooandclass Bar extends Foo, this method would returntrueforBar.class.isAssignableTo(Foo.class).booleanisLocalClass()Checks if this type description represents a local type.booleanisMemberClass()Checks if this type description represents a member type.booleanisPrimitive()Checks if the type described by this entity is a primitive type.booleanrepresents(java.lang.reflect.Type type)Checks if the type described by this instance representstype.-
Methods inherited from class net.bytebuddy.description.type.TypeDescription.AbstractBase
accept, asBoxed, asErasure, asGenericType, asUnboxed, equals, getActualModifiers, getActualName, getDefaultValue, getEnclosingSource, getGenericSignature, getInheritedAnnotations, getInnerClassCount, getInternalName, getSort, getTypeName, hashCode, isAccessibleTo, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isAssignableFrom, isAssignableTo, isConstantPool, isGenerified, isInnerClass, isInstance, isNestedClass, isPackageType, isPrimitiveWrapper, isSamePackage, isVisibleTo, iterator, toString
-
Methods inherited from class net.bytebuddy.description.TypeVariableSource.AbstractBase
findVariable
-
Methods inherited from class net.bytebuddy.description.ModifierReviewable.AbstractBase
getEnumerationState, 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, isVolatile
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable
getSyntheticState, isFinal, isSynthetic
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.ForTypeDefinition
getTypeManifestation, isInterface
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.OfAbstraction
isAbstract
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.OfByteCodeElement
getOwnership, getVisibility, isDeprecated, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.OfEnumeration
getEnumerationState, isEnum
-
Methods inherited from interface net.bytebuddy.description.TypeVariableSource
findVariable
-
-
-
-
Method Detail
-
getName
public static java.lang.String getName(java.lang.Class<?> type)
Returns the type's actual name where it is taken into consideration that this type might be loaded anonymously. In this case, the remainder of the types name is suffixed by/<id>which is removed when using this method but is retained when callingClass.getName().- Parameters:
type- The type for which to resolve its name.- Returns:
- The type's actual name.
-
isAssignableFrom
public boolean isAssignableFrom(java.lang.Class<?> type)
Description copied from interface:TypeDescriptionChecks if this type is assignable from the type described by this instance, for example forclass Fooandclass Bar extends Foo, this method would returntrueforFoo.class.isAssignableFrom(Bar.class).- Specified by:
isAssignableFromin interfaceTypeDescription- Overrides:
isAssignableFromin classTypeDescription.AbstractBase- Parameters:
type- The type of interest.- Returns:
trueif this type is assignable fromtype.
-
isAssignableTo
public boolean isAssignableTo(java.lang.Class<?> type)
Description copied from interface:TypeDescriptionChecks if this type is assignable from the type described by this instance, for example forclass Fooandclass Bar extends Foo, this method would returntrueforBar.class.isAssignableTo(Foo.class).- Specified by:
isAssignableToin interfaceTypeDescription- Overrides:
isAssignableToin classTypeDescription.AbstractBase- Parameters:
type- The type of interest.- Returns:
trueif this type is assignable totype.
-
represents
public boolean represents(java.lang.reflect.Type type)
Description copied from interface:TypeDefinitionChecks if the type described by this instance representstype.- Specified by:
representsin interfaceTypeDefinition- Overrides:
representsin classTypeDescription.AbstractBase- Parameters:
type- The type of interest.- Returns:
trueif the type described by this instance representstype.
-
getComponentType
public TypeDescription getComponentType()
Description copied from interface:TypeDefinitionReturns the component type of this type.
Only non-generic types (
TypeDefinition.Sort.NON_GENERIC) and generic array typesTypeDefinition.Sort.GENERIC_ARRAY) define a component type. For other types, anIllegalStateExceptionis thrown.- Specified by:
getComponentTypein interfaceTypeDefinition- Specified by:
getComponentTypein interfaceTypeDescription- Returns:
- The component type of this type or
nullif this type does not represent an array type.
-
isArray
public boolean isArray()
Description copied from interface:TypeDefinitionChecks if the type described by this entity is an array.- Specified by:
isArrayin interfaceTypeDefinition- Returns:
trueif this type description represents an array.
-
isPrimitive
public boolean isPrimitive()
Description copied from interface:TypeDefinitionChecks if the type described by this entity is a primitive type.- Specified by:
isPrimitivein interfaceTypeDefinition- Returns:
trueif this type description represents a primitive type.
-
isAnnotation
public boolean isAnnotation()
Description copied from interface:ModifierReviewable.ForTypeDefinitionSpecifies if the modifier described by this object represents the annotation flag.- Specified by:
isAnnotationin interfaceModifierReviewable.ForTypeDefinition- Overrides:
isAnnotationin classModifierReviewable.AbstractBase- Returns:
trueif the modifier described by this object represents the annotation flag.
-
getSuperClass
public TypeDescription.Generic getSuperClass()
Description copied from interface:TypeDefinitionReturns the super class of this type. A super type is only defined for non-generic types (TypeDefinition.Sort.NON_GENERIC), parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types. Interface types and theObjectclass do not define a super class wherenullis returned. Array types defineObjectas their direct super class.- Specified by:
getSuperClassin interfaceTypeDefinition- Returns:
- The super class of this type or
nullif no super class exists for this type.
-
getInterfaces
public TypeList.Generic getInterfaces()
Description copied from interface:TypeDefinitionReturns the interfaces that this type implements. A super type is only defined for non-generic types (TypeDefinition.Sort.NON_GENERIC), parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types.- Specified by:
getInterfacesin interfaceTypeDefinition- Returns:
- The interfaces that this type implements.
-
getDeclaringType
public TypeDescription getDeclaringType()
Description copied from interface:DeclaredByTypeReturns the declaring type of this instance.- Specified by:
getDeclaringTypein interfaceDeclaredByType- Specified by:
getDeclaringTypein interfaceTypeDescription- Returns:
- The declaring type or
nullif no such type exists.
-
getEnclosingMethod
public MethodDescription getEnclosingMethod()
Description copied from interface:TypeDescriptionReturns a description of the method that encloses this type. If this method is not enclosed by any type or is enclosed by the type initializer,nullis returned by this method.- Specified by:
getEnclosingMethodin interfaceTypeDescription- Returns:
- A description of the enclosing method of this type or
nullif there is no such method.
-
getEnclosingType
public TypeDescription getEnclosingType()
Description copied from interface:TypeDescriptionReturns a description of this type's enclosing type if any.- Specified by:
getEnclosingTypein interfaceTypeDescription- Returns:
- A description of the enclosing type of this type or
nullif there is no such type.
-
getDeclaredTypes
public TypeList getDeclaredTypes()
Description copied from interface:TypeDescriptionReturns a list of types that are declared by this type excluding anonymous classes.- Specified by:
getDeclaredTypesin interfaceTypeDescription- Returns:
- A list of types that are declared within this type.
-
getSimpleName
public java.lang.String getSimpleName()
Description copied from interface:TypeDescriptionReturns the simple internalName of this type.- Specified by:
getSimpleNamein interfaceTypeDescription- Returns:
- The simple internalName of this type.
-
isAnonymousClass
public boolean isAnonymousClass()
Description copied from interface:TypeDescriptionChecks if this type description represents an anonymous type.- Specified by:
isAnonymousClassin interfaceTypeDescription- Returns:
trueif this type description represents an anonymous type.
-
isLocalClass
public boolean isLocalClass()
Description copied from interface:TypeDescriptionChecks if this type description represents a local type.- Specified by:
isLocalClassin interfaceTypeDescription- Returns:
trueif this type description represents a local type.
-
isMemberClass
public boolean isMemberClass()
Description copied from interface:TypeDescriptionChecks if this type description represents a member type.- Specified by:
isMemberClassin interfaceTypeDescription- Returns:
trueif this type description represents a member type.
-
getDeclaredFields
public FieldList<FieldDescription.InDefinedShape> getDeclaredFields()
Description copied from interface:TypeDefinitionReturns the fields that this type declares. A super type is only defined for non-generic types (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.- Specified by:
getDeclaredFieldsin interfaceTypeDefinition- Specified by:
getDeclaredFieldsin interfaceTypeDescription- Returns:
- The fields that this type declares. A super type is only defined for non-generic types (
TypeDefinition.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.
-
getDeclaredMethods
public MethodList<MethodDescription.InDefinedShape> getDeclaredMethods()
Description copied from interface:TypeDefinitionReturns the methods that this type declares.- Specified by:
getDeclaredMethodsin interfaceTypeDefinition- Specified by:
getDeclaredMethodsin interfaceTypeDescription- Returns:
- The methods that this type declares.
-
getPackage
public PackageDescription getPackage()
Description copied from interface:TypeDescriptionReturns the package internalName of the type described by this instance.- Specified by:
getPackagein interfaceTypeDescription- Returns:
- The package internalName of the type described by this instance.
-
getStackSize
public StackSize getStackSize()
Description copied from interface:TypeDefinitionReturns the size of the type described by this instance. Wildcard types (TypeDefinition.Sort.WILDCARDdo not have a well-defined a stack size and cause anIllegalStateExceptionto be thrown.- Specified by:
getStackSizein interfaceTypeDefinition- Returns:
- The size of the type described by this instance.
-
getName
public java.lang.String getName()
Description copied from interface:NamedElement.WithRuntimeNameReturns the internalName of this byte code element.- Specified by:
getNamein interfaceNamedElement.WithRuntimeName- Returns:
- The internalName of this byte code element as visible from within a running Java application.
-
getCanonicalName
public java.lang.String getCanonicalName()
Description copied from interface:TypeDescriptionReturns the canonical name of this type if it exists.- Specified by:
getCanonicalNamein interfaceTypeDescription- Returns:
- The canonical name of this type. Might be
null.
-
getDescriptor
public java.lang.String getDescriptor()
Description copied from interface:ByteCodeElementReturns the descriptor of this byte code element.- Specified by:
getDescriptorin interfaceByteCodeElement- Returns:
- The descriptor of this byte code element.
-
getModifiers
public int getModifiers()
Description copied from interface:ModifierReviewableReturns the modifier that is described by this object.- Specified by:
getModifiersin interfaceModifierReviewable- Returns:
- The modifier that is described by this object.
-
getTypeVariables
public TypeList.Generic getTypeVariables()
Description copied from interface:TypeVariableSourceReturns the type variables that are declared by this element.- Specified by:
getTypeVariablesin interfaceTypeVariableSource- Returns:
- The type variables that are declared by this element.
-
getDeclaredAnnotations
public AnnotationList getDeclaredAnnotations()
Description copied from interface:AnnotationSourceReturns a list of annotations that are declared by this instance.- Specified by:
getDeclaredAnnotationsin interfaceAnnotationSource- Returns:
- A list of declared annotations.
-
-