Package net.bytebuddy.pool
Class TypePool.Default.LazyTypeDescription
- java.lang.Object
-
- net.bytebuddy.description.ModifierReviewable.AbstractBase
-
- net.bytebuddy.description.TypeVariableSource.AbstractBase
-
- net.bytebuddy.description.type.TypeDescription.AbstractBase
-
- net.bytebuddy.description.type.TypeDescription.AbstractBase.OfSimpleType
-
- net.bytebuddy.pool.TypePool.Default.LazyTypeDescription
-
- All Implemented Interfaces:
java.lang.Iterable<TypeDefinition>
,AnnotationSource
,ByteCodeElement
,DeclaredByType
,ModifierReviewable
,ModifierReviewable.ForFieldDescription
,ModifierReviewable.ForMethodDescription
,ModifierReviewable.ForParameterDescription
,ModifierReviewable.ForTypeDefinition
,ModifierReviewable.OfAbstraction
,ModifierReviewable.OfByteCodeElement
,ModifierReviewable.OfEnumeration
,NamedElement
,NamedElement.WithDescriptor
,NamedElement.WithRuntimeName
,TypeDefinition
,TypeDescription
,TypeVariableSource
- Enclosing class:
- TypePool.Default
protected static class TypePool.Default.LazyTypeDescription extends TypeDescription.AbstractBase.OfSimpleType
A type description that looks up any referencedByteCodeElement
orAnnotationDescription
by querying a type pool at lookup time.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
TypePool.Default.LazyTypeDescription.AnnotationToken
A token for representing collected data on an annotation.protected static class
TypePool.Default.LazyTypeDescription.FieldToken
A token for representing collected data on a field.protected class
TypePool.Default.LazyTypeDescription.FieldTokenList
A list of field tokens representing each entry as a field description.protected static interface
TypePool.Default.LazyTypeDescription.GenericTypeToken
A token that represents a generic Java type.private static class
TypePool.Default.LazyTypeDescription.LazyAnnotationDescription
A lazy description of an annotation that looks up types from a type pool when required.private static class
TypePool.Default.LazyTypeDescription.LazyAnnotationValue<U,V>
A proxy for a lazy annotation value.private class
TypePool.Default.LazyTypeDescription.LazyFieldDescription
A lazy field description that only resolved type references when required.private class
TypePool.Default.LazyTypeDescription.LazyMethodDescription
A lazy representation of a method that resolves references to types only on demand.protected static class
TypePool.Default.LazyTypeDescription.LazyNestMemberList
A lazy list that represents all nest members of the represented type.private static class
TypePool.Default.LazyTypeDescription.LazyPackageDescription
An implementation of aPackageDescription
that only loads its annotations on requirement.private class
TypePool.Default.LazyTypeDescription.LazyRecordComponentDescription
A lazy description of a record component.protected static class
TypePool.Default.LazyTypeDescription.LazyTypeList
A list that is constructingTypePool.Default.LazyTypeDescription
s.protected static class
TypePool.Default.LazyTypeDescription.MethodToken
A token for representing collected data on a method.protected class
TypePool.Default.LazyTypeDescription.MethodTokenList
A list of method tokens representing each entry as a method description.protected static class
TypePool.Default.LazyTypeDescription.RecordComponentToken
A token representing a record component.protected class
TypePool.Default.LazyTypeDescription.RecordComponentTokenList
A list of record component tokens representing each record component as a description.protected static class
TypePool.Default.LazyTypeDescription.TokenizedGenericType
A representation of a generic type that is described by aTypePool.Default.LazyTypeDescription.GenericTypeToken
.protected static interface
TypePool.Default.LazyTypeDescription.TypeContainment
A declaration context encapsulates information about whether a type was declared within another type or within a method of another type.-
Nested classes/interfaces inherited from class net.bytebuddy.description.type.TypeDescription.AbstractBase.OfSimpleType
TypeDescription.AbstractBase.OfSimpleType.WithDelegation
-
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.WithDescriptor, 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 Modifier and Type Field Description private int
actualModifiers
The actual modifiers of this type.private java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>
annotationTokens
A list of tokens that represent the annotations of this type.private boolean
anonymousType
true
if this type is an anonymous type.private java.util.List<java.lang.String>
declaredTypes
A list of descriptors representing the types that are declared by this type.private java.lang.String
declaringTypeName
The binary name of this type's declaring type ornull
if no such type exists.private java.util.List<TypePool.Default.LazyTypeDescription.FieldToken>
fieldTokens
A list of field tokens describing the field's of this type.private java.lang.String
genericSignature
The type's generic signature as found in the class file ornull
if the type is not generic.private java.util.List<java.lang.String>
interfaceTypeDescriptors
The descriptor of this type's interfaces.private java.util.List<TypePool.Default.LazyTypeDescription.MethodToken>
methodTokens
A list of method tokens describing the method's of this type.private int
modifiers
The modifiers of this type.private java.lang.String
name
The binary name of this type.private java.lang.String
nestHost
The binary name of the nest host ornull
if no nest host was specified.private java.util.List<java.lang.String>
nestMembers
A list of binary names of all specified nest members.private static java.lang.String
NO_TYPE
Indicates that a type does not exist and does therefore not have a name.private java.util.List<java.lang.String>
permittedSubclasses
A list of internal names of permitted subclasses.private java.util.List<TypePool.Default.LazyTypeDescription.RecordComponentToken>
recordComponentTokens
A list of record component tokens describing the record components of this type.private TypePool.Default.LazyTypeDescription.GenericTypeToken.Resolution.ForType
signatureResolution
The resolution of this type's generic type.private static int
SUPER_CLASS_INDEX
The index of a super class's type annotations.private java.lang.String
superClassDescriptor
The type's super type's descriptor ornull
if this type does not define a super type.private java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>>
superTypeAnnotationTokens
A mapping of type annotations for this type's super type and interface types by their indices.private TypePool.Default.LazyTypeDescription.TypeContainment
typeContainment
A definition of this type's containment within another type or method.private TypePool
typePool
The type pool to be used for looking up linked types.private java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>>
typeVariableAnnotationTokens
A mapping of type annotations of the type variables' type annotations by their indices.private java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>>>
typeVariableBoundsAnnotationTokens
A mapping of type annotations of the type variables' bounds' type annotations by their indices and each variable's index.-
Fields inherited from class net.bytebuddy.description.type.TypeDescription.AbstractBase
RAW_TYPES
-
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.NamedElement.WithDescriptor
NON_GENERIC_SIGNATURE
-
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 Modifier Constructor Description protected
LazyTypeDescription(TypePool typePool, int actualModifiers, int modifiers, java.lang.String name, java.lang.String superClassInternalName, java.lang.String[] interfaceInternalName, java.lang.String genericSignature, TypePool.Default.LazyTypeDescription.TypeContainment typeContainment, java.lang.String declaringTypeInternalName, java.util.List<java.lang.String> declaredTypes, boolean anonymousType, java.lang.String nestHostInternalName, java.util.List<java.lang.String> nestMemberInternalNames, java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>> superTypeAnnotationTokens, java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>> typeVariableAnnotationTokens, java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>>> typeVariableBoundsAnnotationTokens, java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken> annotationTokens, java.util.List<TypePool.Default.LazyTypeDescription.FieldToken> fieldTokens, java.util.List<TypePool.Default.LazyTypeDescription.MethodToken> methodTokens, java.util.List<TypePool.Default.LazyTypeDescription.RecordComponentToken> recordComponentTokens, java.util.List<java.lang.String> permittedSubclasses)
Creates a new lazy type description.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getActualModifiers(boolean superFlag)
Returns the type's actual modifiers as present in the class file.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.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.java.lang.String
getGenericSignature()
Returns the generic signature of this byte code element.TypeList.Generic
getInterfaces()
Returns the interfaces that this type implements.int
getModifiers()
Returns the modifier that is described by this object.java.lang.String
getName()
Returns the internalName of this byte code element.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 ornull
if the described type does not imply a package.TypeList
getPermittedSubclasses()
Returns the list of permitted subclasses if this class is a sealed class or an empty list if this class is not sealed.RecordComponentList<RecordComponentDescription.InDefinedShape>
getRecordComponents()
Returns the list of record components that are declared by this type.TypeDescription.Generic
getSuperClass()
Returns the super class of this type.TypeList.Generic
getTypeVariables()
Returns the type variables that are declared by this element.boolean
isAnonymousType()
Checks if this type description represents an anonymous type.boolean
isLocalType()
Checks if this type description represents a local type.boolean
isRecord()
Checks if this type is a Java record.-
Methods inherited from class net.bytebuddy.description.type.TypeDescription.AbstractBase.OfSimpleType
getCanonicalName, getComponentType, getDescriptor, getSimpleName, getStackSize, isArray, isPrimitive
-
Methods inherited from class net.bytebuddy.description.type.TypeDescription.AbstractBase
accept, asBoxed, asErasure, asGenericType, asUnboxed, equals, getActualName, getDefaultValue, getEnclosingSource, getInheritedAnnotations, getInnerClassCount, getInternalName, getSort, getTypeName, hashCode, isAccessibleTo, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isAssignableFrom, isAssignableFrom, isAssignableTo, isAssignableTo, isCompileTimeConstant, isGenerified, isInferrable, isInHierarchyWith, isInHierarchyWith, isInnerClass, isInstance, isMemberType, isNestedClass, isNestHost, isNestMateOf, isNestMateOf, isPackageType, isPrimitiveWrapper, isSamePackage, isSealed, isVisibleTo, iterator, represents, 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, isAnnotation, 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, isAnnotation, 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
-
-
-
-
Field Detail
-
SUPER_CLASS_INDEX
private static final int SUPER_CLASS_INDEX
The index of a super class's type annotations.- See Also:
- Constant Field Values
-
NO_TYPE
private static final java.lang.String NO_TYPE
Indicates that a type does not exist and does therefore not have a name.
-
typePool
private final TypePool typePool
The type pool to be used for looking up linked types.
-
actualModifiers
private final int actualModifiers
The actual modifiers of this type.
-
modifiers
private final int modifiers
The modifiers of this type.
-
name
private final java.lang.String name
The binary name of this type.
-
superClassDescriptor
private final java.lang.String superClassDescriptor
The type's super type's descriptor ornull
if this type does not define a super type.
-
genericSignature
private final java.lang.String genericSignature
The type's generic signature as found in the class file ornull
if the type is not generic.
-
signatureResolution
private final TypePool.Default.LazyTypeDescription.GenericTypeToken.Resolution.ForType signatureResolution
The resolution of this type's generic type.
-
interfaceTypeDescriptors
private final java.util.List<java.lang.String> interfaceTypeDescriptors
The descriptor of this type's interfaces.
-
typeContainment
private final TypePool.Default.LazyTypeDescription.TypeContainment typeContainment
A definition of this type's containment within another type or method.
-
declaringTypeName
private final java.lang.String declaringTypeName
The binary name of this type's declaring type ornull
if no such type exists.
-
declaredTypes
private final java.util.List<java.lang.String> declaredTypes
A list of descriptors representing the types that are declared by this type.
-
anonymousType
private final boolean anonymousType
true
if this type is an anonymous type.
-
nestHost
private final java.lang.String nestHost
The binary name of the nest host ornull
if no nest host was specified.
-
nestMembers
private final java.util.List<java.lang.String> nestMembers
A list of binary names of all specified nest members.
-
superTypeAnnotationTokens
private final java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>> superTypeAnnotationTokens
A mapping of type annotations for this type's super type and interface types by their indices.
-
typeVariableAnnotationTokens
private final java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>> typeVariableAnnotationTokens
A mapping of type annotations of the type variables' type annotations by their indices.
-
typeVariableBoundsAnnotationTokens
private final java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>>> typeVariableBoundsAnnotationTokens
A mapping of type annotations of the type variables' bounds' type annotations by their indices and each variable's index.
-
annotationTokens
private final java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken> annotationTokens
A list of tokens that represent the annotations of this type.
-
fieldTokens
private final java.util.List<TypePool.Default.LazyTypeDescription.FieldToken> fieldTokens
A list of field tokens describing the field's of this type.
-
methodTokens
private final java.util.List<TypePool.Default.LazyTypeDescription.MethodToken> methodTokens
A list of method tokens describing the method's of this type.
-
recordComponentTokens
private final java.util.List<TypePool.Default.LazyTypeDescription.RecordComponentToken> recordComponentTokens
A list of record component tokens describing the record components of this type.
-
permittedSubclasses
private final java.util.List<java.lang.String> permittedSubclasses
A list of internal names of permitted subclasses.
-
-
Constructor Detail
-
LazyTypeDescription
protected LazyTypeDescription(TypePool typePool, int actualModifiers, int modifiers, java.lang.String name, java.lang.String superClassInternalName, java.lang.String[] interfaceInternalName, java.lang.String genericSignature, TypePool.Default.LazyTypeDescription.TypeContainment typeContainment, java.lang.String declaringTypeInternalName, java.util.List<java.lang.String> declaredTypes, boolean anonymousType, java.lang.String nestHostInternalName, java.util.List<java.lang.String> nestMemberInternalNames, java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>> superTypeAnnotationTokens, java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>> typeVariableAnnotationTokens, java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.util.Map<java.lang.String,java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken>>>> typeVariableBoundsAnnotationTokens, java.util.List<TypePool.Default.LazyTypeDescription.AnnotationToken> annotationTokens, java.util.List<TypePool.Default.LazyTypeDescription.FieldToken> fieldTokens, java.util.List<TypePool.Default.LazyTypeDescription.MethodToken> methodTokens, java.util.List<TypePool.Default.LazyTypeDescription.RecordComponentToken> recordComponentTokens, java.util.List<java.lang.String> permittedSubclasses)
Creates a new lazy type description.- Parameters:
typePool
- The type pool to be used for looking up linked types.actualModifiers
- The actual modifiers of this type.modifiers
- The modifiers of this type.name
- The binary name of this type.superClassInternalName
- The internal name of this type's super type ornull
if no such super type is defined.interfaceInternalName
- An array of this type's interfaces ornull
if this type does not define any interfaces.genericSignature
- The type's generic signature as found in the class file ornull
if the type is not generic.typeContainment
- A definition of this type's containment within another type or method.declaringTypeInternalName
- The internal name of this type's declaring type ornull
if no such type exists.declaredTypes
- A list of descriptors representing the types that are declared by this type.anonymousType
-true
if this type is an anonymous type.nestHostInternalName
- The internal name of the nest host ornull
if no nest host was specified.nestMemberInternalNames
- A list of internal names of the nest members.superTypeAnnotationTokens
- A mapping of type annotations for this type's super type and interface types by their indices.typeVariableAnnotationTokens
- A mapping of type annotations of the type variables' type annotations by their indices.typeVariableBoundsAnnotationTokens
- A mapping of type annotations of the type variables' bounds' type annotations by their indices and each variable's index.annotationTokens
- A list of tokens that represent the annotations of this type.fieldTokens
- A list of field tokens describing the field's of this type.methodTokens
- A list of method tokens describing the method's of this type.recordComponentTokens
- A list of record component tokens describing the record components of this type.permittedSubclasses
- A list of internal names of permitted subclasses.
-
-
Method Detail
-
getSuperClass
public TypeDescription.Generic getSuperClass()
Returns 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 theObject
class do not define a super class wherenull
is returned. Array types defineObject
as their direct super class.- Returns:
- The super class of this type or
null
if no super class exists for this type.
-
getInterfaces
public TypeList.Generic getInterfaces()
Returns 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.- Returns:
- The interfaces that this type implements.
-
getEnclosingMethod
public MethodDescription.InDefinedShape getEnclosingMethod()
Returns 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,null
is returned by this method.- Returns:
- A description of the enclosing method of this type or
null
if there is no such method.
-
getEnclosingType
public TypeDescription getEnclosingType()
Returns a description of this type's enclosing type if any.- Returns:
- A description of the enclosing type of this type or
null
if there is no such type.
-
getDeclaredTypes
public TypeList getDeclaredTypes()
Returns a list of types that are declared by this type. This list does not normally include anonymous types but might include additional types if they are explicitly added to an instrumented type.- Returns:
- A list of types that are declared within this type.
-
isAnonymousType
public boolean isAnonymousType()
Checks if this type description represents an anonymous type.- Returns:
true
if this type description represents an anonymous type.
-
isLocalType
public boolean isLocalType()
Checks if this type description represents a local type.- Returns:
true
if this type description represents a local type.
-
getDeclaredFields
public FieldList<FieldDescription.InDefinedShape> getDeclaredFields()
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 fields and the returned list is always empty for such types.- 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()
Returns the methods that this type declares.- Returns:
- The methods that this type declares.
-
getPackage
public PackageDescription getPackage()
Returns the package of the type described by this instance ornull
if the described type does not imply a package.- Returns:
- The package of the type described by this instance or
null
if the described type does not imply a package.
-
getName
public java.lang.String getName()
Returns the internalName of this byte code element.- Returns:
- The internalName of this byte code element as visible from within a running Java application.
-
getDeclaringType
public TypeDescription getDeclaringType()
Returns the declaring type of this instance.- Returns:
- The declaring type or
null
if no such type exists.
-
getModifiers
public int getModifiers()
Returns the modifier that is described by this object.- Returns:
- The modifier that is described by this object.
-
getActualModifiers
public int getActualModifiers(boolean superFlag)
Returns the type's actual modifiers as present in the class file. For example, a type cannot beprivate
. 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 asDeprecated
. Anonymous classes that are enclosed in a static method or the type initializer are additionally marked asfinal
as it is also done by the Java compiler.- Specified by:
getActualModifiers
in interfaceTypeDescription
- Overrides:
getActualModifiers
in classTypeDescription.AbstractBase
- Parameters:
superFlag
-true
if the modifier's super flag should be set.- Returns:
- The type's actual modifiers.
-
getNestHost
public TypeDescription getNestHost()
Returns the nest host of this type. For types prior to Java 11, this type is returned which is the default nest host.- Returns:
- The nest host of this type.
-
getNestMembers
public TypeList getNestMembers()
Returns a list of members that are part of a nesting group. Prior to Java 11, a list that only contains this type is returned which is the default nest group.- Returns:
- A list of members of this nest group.
-
getDeclaredAnnotations
public AnnotationList getDeclaredAnnotations()
Returns a list of annotations that are declared by this instance.- Returns:
- A list of declared annotations.
-
getTypeVariables
public TypeList.Generic getTypeVariables()
Returns the type variables that are declared by this element.- Returns:
- The type variables that are declared by this element.
-
getGenericSignature
public java.lang.String getGenericSignature()
Description copied from class:TypeDescription.AbstractBase
Returns the generic signature of this byte code element. If this element does not reference generic types or references malformed generic types,null
is returned as a signature.- Specified by:
getGenericSignature
in interfaceNamedElement.WithDescriptor
- Overrides:
getGenericSignature
in classTypeDescription.AbstractBase
- Returns:
- The generic signature or
null
if this element is not generic.
-
getRecordComponents
public RecordComponentList<RecordComponentDescription.InDefinedShape> getRecordComponents()
Returns the list of record components that are declared by this type. If this type is not a record, the returned list is empty.- Returns:
- A list of record components that this type declares.
-
isRecord
public boolean isRecord()
Checks if this type is a Java record.- Returns:
true
if this type is a Java record.
-
getPermittedSubclasses
public TypeList getPermittedSubclasses()
Returns the list of permitted subclasses if this class is a sealed class or an empty list if this class is not sealed.- Returns:
- The list of permitted subclasses if this class is a sealed class or an empty list if this class is not sealed.
-
-