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.WithDescriptor
,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 Modifier and Type Class Description protected static class
TypeDescription.ForLoadedType.ClassDescriptionTypeList
A list of type descriptions represented by class descriptions.protected static interface
TypeDescription.ForLoadedType.Dispatcher
A dispatcher for using methods ofClass
that are not declared for Java 6.-
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 static TypeDescription.ForLoadedType.Dispatcher
DISPATCHER
A dispatcher for invking methods onClass
reflectively.private static long
serialVersionUID
The class's serial version UID.private java.lang.Class<?>
type
The loaded type this instance represents.private static java.util.Map<java.lang.Class<?>,TypeDescription>
TYPE_CACHE
A cache of type descriptions for commonly used types to avoid unnecessary allocations.-
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 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 TypeDescription.Generic
asGenericType()
Returns this type definition as a generic type.java.lang.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.java.lang.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.java.lang.String
getName()
Returns the internalName of this byte code element.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.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.java.lang.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(java.lang.Class<?> type)
Checks if this type is assignable from the type described by this instance, for example forclass Foo
andclass Bar extends Foo
, this method would returntrue
forFoo.class.isAssignableFrom(Bar.class)
.boolean
isAssignableFrom(TypeDescription typeDescription)
Checks if this type is assignable from the type described by this instance, for example forclass Foo
andclass Bar extends Foo
, this method would returntrue
forFoo.class.isAssignableFrom(Bar.class)
.boolean
isAssignableTo(java.lang.Class<?> type)
Checks if this type is assignable from the type described by this instance, for example forclass Foo
andclass Bar extends Foo
, this method would returntrue
forBar.class.isAssignableTo(Foo.class)
.boolean
isAssignableTo(TypeDescription typeDescription)
Checks if this type is assignable from the type described by this instance, for example forclass Foo
andclass Bar extends Foo
, this method would returntrue
forBar.class.isAssignableFrom(Foo.class)
.boolean
isInHierarchyWith(java.lang.Class<?> type)
Returnstrue
if this type and the supplied type are in a type hierarchy with each other, i.e.boolean
isInHierarchyWith(TypeDescription typeDescription)
Returnstrue
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(java.lang.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.boolean
isRecord()
Checks if this type is a Java record.static TypeDescription
of(java.lang.Class<?> type)
Returns a new immutable type description for a loaded type.boolean
represents(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, asUnboxed, equals, getActualModifiers, getActualName, getDefaultValue, getEnclosingSource, getGenericSignature, getInheritedAnnotations, getInnerClassCount, getInternalName, getSort, getTypeName, hashCode, isAccessibleTo, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isCompileTimeConstant, isGenerified, isInferrable, isInnerClass, isInstance, isNestedClass, isPackageType, isPrimitiveWrapper, isSamePackage, isSealed, 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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
The class's serial version UID.- See Also:
- Constant Field Values
-
DISPATCHER
private static final TypeDescription.ForLoadedType.Dispatcher DISPATCHER
A dispatcher for invking methods onClass
reflectively.
-
TYPE_CACHE
private static final java.util.Map<java.lang.Class<?>,TypeDescription> TYPE_CACHE
A cache of type descriptions for commonly used types to avoid unnecessary allocations.
-
type
private final java.lang.Class<?> type
The loaded type this instance represents.
-
-
Constructor Detail
-
ForLoadedType
public ForLoadedType(java.lang.Class<?> type)
Creates a new immutable type description for a loaded type. This constructor should not normally be used. Useof(Class)
instead.- Parameters:
type
- The type to be represented by this type description.
-
-
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.
-
of
public static TypeDescription of(java.lang.Class<?> type)
Returns a new immutable type description for a loaded type.- Parameters:
type
- The type to be represented by this type description.- Returns:
- The type description representing the given type.
-
isAssignableFrom
public boolean isAssignableFrom(java.lang.Class<?> type)
Description copied from class:TypeDescription.AbstractBase
Checks if this type is assignable from the type described by this instance, for example forclass Foo
andclass Bar extends Foo
, this method would returntrue
forFoo.class.isAssignableFrom(Bar.class)
.- Specified by:
isAssignableFrom
in interfaceTypeDescription
- Overrides:
isAssignableFrom
in classTypeDescription.AbstractBase
- Parameters:
type
- The type of interest.- Returns:
true
if this type is assignable fromtype
.
-
isAssignableFrom
public boolean isAssignableFrom(TypeDescription typeDescription)
Description copied from class:TypeDescription.AbstractBase
Checks if this type is assignable from the type described by this instance, for example forclass Foo
andclass Bar extends Foo
, this method would returntrue
forFoo.class.isAssignableFrom(Bar.class)
.TypeDescription.isAssignableFrom(Class)
- Specified by:
isAssignableFrom
in interfaceTypeDescription
- Overrides:
isAssignableFrom
in classTypeDescription.AbstractBase
- Parameters:
typeDescription
- The type of interest.- Returns:
true
if this type is assignable fromtype
.
-
isAssignableTo
public boolean isAssignableTo(java.lang.Class<?> type)
Description copied from class:TypeDescription.AbstractBase
Checks if this type is assignable from the type described by this instance, for example forclass Foo
andclass Bar extends Foo
, this method would returntrue
forBar.class.isAssignableTo(Foo.class)
.- Specified by:
isAssignableTo
in interfaceTypeDescription
- Overrides:
isAssignableTo
in classTypeDescription.AbstractBase
- Parameters:
type
- The type of interest.- Returns:
true
if this type is assignable totype
.
-
isAssignableTo
public boolean isAssignableTo(TypeDescription typeDescription)
Description copied from class:TypeDescription.AbstractBase
Checks if this type is assignable from the type described by this instance, for example forclass Foo
andclass Bar extends Foo
, this method would returntrue
forBar.class.isAssignableFrom(Foo.class)
.TypeDescription.isAssignableTo(Class)
- Specified by:
isAssignableTo
in interfaceTypeDescription
- Overrides:
isAssignableTo
in classTypeDescription.AbstractBase
- Parameters:
typeDescription
- The type of interest.- Returns:
true
if this type is assignable totype
.
-
isInHierarchyWith
public boolean isInHierarchyWith(java.lang.Class<?> type)
Description copied from class:TypeDescription.AbstractBase
Returnstrue
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.- Specified by:
isInHierarchyWith
in interfaceTypeDescription
- Overrides:
isInHierarchyWith
in classTypeDescription.AbstractBase
- Parameters:
type
- The type of interest.- Returns:
true
if this type and the supplied type are in a type hierarchy with each other.
-
isInHierarchyWith
public boolean isInHierarchyWith(TypeDescription typeDescription)
Description copied from class:TypeDescription.AbstractBase
Returnstrue
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.- Specified by:
isInHierarchyWith
in interfaceTypeDescription
- Overrides:
isInHierarchyWith
in classTypeDescription.AbstractBase
- Parameters:
typeDescription
- The type of interest.- Returns:
true
if this type and the supplied type are in a type hierarchy with each other.
-
represents
public boolean represents(java.lang.reflect.Type type)
Description copied from class:TypeDescription.AbstractBase
Checks if the type described by this instance representstype
.- Specified by:
represents
in interfaceTypeDefinition
- Overrides:
represents
in classTypeDescription.AbstractBase
- Parameters:
type
- The type of interest.- Returns:
true
if the type described by this instance representstype
.
-
getComponentType
public TypeDescription getComponentType()
Returns 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, anIllegalStateException
is thrown.- Specified by:
getComponentType
in interfaceTypeDefinition
- Specified by:
getComponentType
in interfaceTypeDescription
- Returns:
- The component type of this type or
null
if this type does not represent an array type.
-
isArray
public boolean isArray()
Checks if the type described by this entity is an array.- Specified by:
isArray
in interfaceTypeDefinition
- Returns:
true
if this type description represents an array.
-
isPrimitive
public boolean isPrimitive()
Checks if the type described by this entity is a primitive type.- Specified by:
isPrimitive
in interfaceTypeDefinition
- Returns:
true
if this type description represents a primitive type.
-
isAnnotation
public boolean isAnnotation()
Description copied from class:ModifierReviewable.AbstractBase
Specifies if the modifier described by this object represents the annotation flag.- Specified by:
isAnnotation
in interfaceModifierReviewable.ForTypeDefinition
- Overrides:
isAnnotation
in classModifierReviewable.AbstractBase
- Returns:
true
if the modifier described by this object represents the annotation flag.
-
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.- Specified by:
getSuperClass
in interfaceTypeDefinition
- 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.- Specified by:
getInterfaces
in interfaceTypeDefinition
- Returns:
- The interfaces that this type implements.
-
getDeclaringType
public TypeDescription getDeclaringType()
Returns the declaring type of this instance.- Specified by:
getDeclaringType
in interfaceDeclaredByType
- Specified by:
getDeclaringType
in interfaceTypeDescription
- Returns:
- The declaring type or
null
if no such type exists.
-
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.- Specified by:
getEnclosingMethod
in interfaceTypeDescription
- 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.- Specified by:
getEnclosingType
in interfaceTypeDescription
- 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.- Specified by:
getDeclaredTypes
in interfaceTypeDescription
- Returns:
- A list of types that are declared within this type.
-
getSimpleName
public java.lang.String getSimpleName()
Returns the simple internalName of this type.- Specified by:
getSimpleName
in interfaceTypeDescription
- Returns:
- The simple internalName of this type.
-
isAnonymousType
public boolean isAnonymousType()
Checks if this type description represents an anonymous type.- Specified by:
isAnonymousType
in interfaceTypeDescription
- Returns:
true
if this type description represents an anonymous type.
-
isLocalType
public boolean isLocalType()
Checks if this type description represents a local type.- Specified by:
isLocalType
in interfaceTypeDescription
- Returns:
true
if this type description represents a local type.
-
isMemberType
public boolean isMemberType()
Description copied from class:TypeDescription.AbstractBase
Checks if this type description represents a member type.- Specified by:
isMemberType
in interfaceTypeDescription
- Overrides:
isMemberType
in classTypeDescription.AbstractBase
- Returns:
true
if this type description represents a member type.
-
getDeclaredFields
@Enhance("declaredFields") 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.- Specified by:
getDeclaredFields
in interfaceTypeDefinition
- Specified by:
getDeclaredFields
in 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
@Enhance("declaredMethods") public MethodList<MethodDescription.InDefinedShape> getDeclaredMethods()
Returns the methods that this type declares.- Specified by:
getDeclaredMethods
in interfaceTypeDefinition
- Specified by:
getDeclaredMethods
in interfaceTypeDescription
- 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.- Specified by:
getPackage
in interfaceTypeDescription
- Returns:
- The package of the type described by this instance or
null
if the described type does not imply a package.
-
getStackSize
public StackSize getStackSize()
Returns the size of the type described by this instance. Wildcard types (TypeDefinition.Sort.WILDCARD
do not have a well-defined a stack size and cause anIllegalStateException
to be thrown.- Specified by:
getStackSize
in interfaceTypeDefinition
- Returns:
- The size of the type described by this instance.
-
getName
public java.lang.String getName()
Returns the internalName of this byte code element.- Specified by:
getName
in interfaceNamedElement.WithRuntimeName
- Returns:
- The internalName of this byte code element as visible from within a running Java application.
-
getCanonicalName
public java.lang.String getCanonicalName()
Returns the canonical name of this type if it exists.- Specified by:
getCanonicalName
in interfaceTypeDescription
- Returns:
- The canonical name of this type. Might be
null
.
-
getDescriptor
public java.lang.String getDescriptor()
Returns the descriptor of this byte code element.- Specified by:
getDescriptor
in interfaceNamedElement.WithDescriptor
- Returns:
- The descriptor of this byte code element.
-
getModifiers
public int getModifiers()
Returns the modifier that is described by this object.- Specified by:
getModifiers
in interfaceModifierReviewable
- Returns:
- The modifier that is described by this object.
-
getTypeVariables
public TypeList.Generic getTypeVariables()
Returns the type variables that are declared by this element.- Specified by:
getTypeVariables
in interfaceTypeVariableSource
- Returns:
- The type variables that are declared by this element.
-
getDeclaredAnnotations
@Enhance("declaredAnnotations") public AnnotationList getDeclaredAnnotations()
Returns a list of annotations that are declared by this instance.- Specified by:
getDeclaredAnnotations
in interfaceAnnotationSource
- Returns:
- A list of declared annotations.
-
asGenericType
public TypeDescription.Generic asGenericType()
Returns this type definition as a generic type.- Specified by:
asGenericType
in interfaceTypeDefinition
- Overrides:
asGenericType
in classTypeDescription.AbstractBase
- Returns:
- This type definition represented as a generic type.
-
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.- Specified by:
getNestHost
in interfaceTypeDescription
- 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.- Specified by:
getNestMembers
in interfaceTypeDescription
- Returns:
- A list of members of this nest group.
-
isNestHost
public boolean isNestHost()
Description copied from class:TypeDescription.AbstractBase
Checks if this class is the host of a nest group.- Specified by:
isNestHost
in interfaceTypeDescription
- Overrides:
isNestHost
in classTypeDescription.AbstractBase
- Returns:
true
if this class is a nest group's host.
-
isNestMateOf
public boolean isNestMateOf(java.lang.Class<?> type)
Description copied from class:TypeDescription.AbstractBase
Checks if this type and the supplied type are members of the same nest group.- Specified by:
isNestMateOf
in interfaceTypeDescription
- Overrides:
isNestMateOf
in classTypeDescription.AbstractBase
- Parameters:
type
- The type for which to check if it is a member of the same nest group.- Returns:
true
if this type and the supplied type are members of the same nest group.
-
isNestMateOf
public boolean isNestMateOf(TypeDescription typeDescription)
Description copied from class:TypeDescription.AbstractBase
Checks if this type and the supplied type are members of the same nest group.- Specified by:
isNestMateOf
in interfaceTypeDescription
- Overrides:
isNestMateOf
in classTypeDescription.AbstractBase
- Parameters:
typeDescription
- The type for which to check if it is a member of the same nest group.- Returns:
true
if this type and the supplied type are members of the same nest group.
-
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.- Specified by:
getRecordComponents
in interfaceTypeDefinition
- Specified by:
getRecordComponents
in interfaceTypeDescription
- Returns:
- A list of record components that this type declares.
-
isRecord
public boolean isRecord()
Checks if this type is a Java record.- Specified by:
isRecord
in interfaceTypeDefinition
- 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.- Specified by:
getPermittedSubclasses
in interfaceTypeDescription
- Returns:
- The list of permitted subclasses if this class is a sealed class or an empty list if this class is not sealed.
-
-