Package net.bytebuddy.description.type
Class TypeDescription.AbstractBase.OfSimpleType.WithDelegation
- 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.description.type.TypeDescription.AbstractBase.OfSimpleType.WithDelegation
-
- All Implemented Interfaces:
java.lang.Iterable<TypeDefinition>,AnnotationSource,ByteCodeElement,DeclaredByType,ModifierReviewable,ModifierReviewable.ForFieldDescription,ModifierReviewable.ForMethodDescription,ModifierReviewable.ForModuleDescription,ModifierReviewable.ForModuleRequirement,ModifierReviewable.ForParameterDescription,ModifierReviewable.ForTypeDefinition,ModifierReviewable.OfAbstraction,ModifierReviewable.OfByteCodeElement,ModifierReviewable.OfEnumeration,ModifierReviewable.OfMandatable,NamedElement,NamedElement.WithDescriptor,NamedElement.WithRuntimeName,TypeDefinition,TypeDescription,TypeVariableSource
- Direct Known Subclasses:
TypePool.Default.WithLazyResolution.ExtendedLazyTypeDescription,TypePool.Default.WithLazyResolution.LazyTypeDescription,TypePool.LazyFacade.LazyTypeDescription
- Enclosing class:
- TypeDescription.AbstractBase.OfSimpleType
public abstract static class TypeDescription.AbstractBase.OfSimpleType.WithDelegation extends TypeDescription.AbstractBase.OfSimpleType
An implementation of a type description that delegates all properties but the type's name to a delegate.
-
-
Nested Class Summary
-
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.Member, 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.DeclaredByType
DeclaredByType.WithMandatoryDeclaration
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.ModifierReviewable
ModifierReviewable.AbstractBase, ModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForModuleDescription, ModifierReviewable.ForModuleRequirement, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumeration, ModifierReviewable.OfMandatable
-
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.LazyProxy, 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.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 WithDelegation()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TypeDescriptiondelegate()Returns the delegate type description to this type instance.intgetActualModifiers(boolean superFlag)Returns the type's actual modifiers as present in the class file.ClassFileVersiongetClassFileVersion()Attempts to resolve the class file version 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.TypeDescriptiongetDeclaringType()Returns the declaring type of this instance.MethodDescription.InDefinedShapegetEnclosingMethod()Returns a description of the method that encloses this type.TypeDescriptiongetEnclosingType()Returns a description of this type's enclosing type if any.java.lang.StringgetGenericSignature()Returns the generic signature of this byte code element.TypeList.GenericgetInterfaces()Returns the interfaces that this type implements.intgetModifiers()Returns the modifier that is described by this object.TypeDescriptiongetNestHost()Returns the nest host of this type.TypeListgetNestMembers()Returns a list of members that are part of a nesting group.PackageDescriptiongetPackage()Returns the package of the type described by this instance ornullif the described type is a primitive type or an array.TypeListgetPermittedSubtypes()Returns the list of permitted direct subclasses if this class is a sealed class.RecordComponentList<RecordComponentDescription.InDefinedShape>getRecordComponents()Returns the list of record components that are declared by this type.TypeDescription.GenericgetSuperClass()Returns the super class of this type.TypeList.GenericgetTypeVariables()Returns the type variables that are declared by this element.booleanisAbstract()Specifies if the modifier described by this object isabstract.booleanisAnnotation()Specifies if the modifier described by this object represents the annotation flag.booleanisAnonymousType()Checks if this type description represents an anonymous type.booleanisEnum()Specifies if the modifier described by this object represents the enum flag.booleanisInterface()Specifies if the modifier described by this object represents the interface flag.booleanisLocalType()Checks if this type description represents a local type.booleanisRecord()Checks if this type is a Java record.booleanisSealed()Returnstrueif this class is a sealed class that only permitts a specified range of subclasses.ModuleDescriptiontoModuleDescription()Returns a representation of a Java module that is represented by this type description, normally amodule-info.classfile.-
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, getLongSimpleName, getSort, getTypeName, hashCode, isAccessibleTo, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isAssignableFrom, isAssignableFrom, isAssignableTo, isAssignableTo, isCompileTimeConstant, isGenerified, isInferrable, isInHierarchyWith, isInHierarchyWith, isInnerClass, isInstance, isMemberType, isModuleType, isNestedClass, isNestHost, isNestMateOf, isNestMateOf, isPackageType, isPrimitiveWrapper, isSamePackage, isVisibleTo, iterator, represents, toSafeString, toString
-
Methods inherited from class net.bytebuddy.description.TypeVariableSource.AbstractBase
findExpectedVariable, findVariable
-
Methods inherited from class net.bytebuddy.description.ModifierReviewable.AbstractBase
getEnumerationState, getFieldManifestation, getFieldPersistence, getMandate, getMethodManifestation, getMethodStrictness, getOpenness, getOwnership, getParameterManifestation, getProvisioningState, getRequiredPhase, getSynchronizationState, getSyntheticState, getTransitivity, getTypeManifestation, getVisibility, isBridge, isDeprecated, isFinal, isMandated, isNative, isOpen, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStaticPhase, isStrict, isSynchronized, isSynthetic, isTransient, isTransitive, 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
-
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
-
Methods inherited from interface net.bytebuddy.description.NamedElement.WithRuntimeName
getName
-
Methods inherited from interface net.bytebuddy.description.TypeVariableSource
findExpectedVariable, findVariable
-
-
-
-
Method Detail
-
delegate
protected abstract TypeDescription delegate()
Returns the delegate type description to this type instance.- Returns:
- The delegate type description.
-
getSuperClass
@MaybeNull 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 theObjectclass do not define a super class wherenullis returned. Array types defineObjectas their direct super class.- Returns:
- The super class of this type or
nullif 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.
-
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.
-
getDeclaringType
@MaybeNull public TypeDescription getDeclaringType()
Returns the declaring type of this instance.- Returns:
- The declaring type or
nullif no such type exists.
-
getEnclosingMethod
@MaybeNull 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,nullis returned by this method.- Returns:
- A description of the enclosing method of this type or
nullif there is no such method.
-
getEnclosingType
@MaybeNull 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
nullif 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:
trueif this type description represents an anonymous type.
-
isLocalType
public boolean isLocalType()
Checks if this type description represents a local type.- Returns:
trueif this type description represents a local type.
-
getPackage
@MaybeNull public PackageDescription getPackage()
Returns the package of the type described by this instance ornullif the described type is a primitive type or an array.- Returns:
- The package of the type described by this instance or
nullif the described type is a primitive type or an array.
-
toModuleDescription
@MaybeNull public ModuleDescription toModuleDescription()
Returns a representation of a Java module that is represented by this type description, normally amodule-info.classfile. If there is no module meta-data attached to the current class,nullis returned.- Returns:
- A description of the module information of this type or
nullif no such information is available.
-
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.
-
getModifiers
public int getModifiers()
Returns the modifier that is described by this object.- Returns:
- The modifier that is described by this object.
-
isAbstract
public boolean isAbstract()
Description copied from class:ModifierReviewable.AbstractBaseSpecifies if the modifier described by this object isabstract.- Specified by:
isAbstractin interfaceModifierReviewable.OfAbstraction- Overrides:
isAbstractin classModifierReviewable.AbstractBase- Returns:
trueif the modifier described by this object isabstract.
-
isEnum
public boolean isEnum()
Description copied from class:ModifierReviewable.AbstractBaseSpecifies if the modifier described by this object represents the enum flag.- Specified by:
isEnumin interfaceModifierReviewable.OfEnumeration- Overrides:
isEnumin classModifierReviewable.AbstractBase- Returns:
trueif the modifier described by this object represents the enum flag.
-
isInterface
public boolean isInterface()
Description copied from class:ModifierReviewable.AbstractBaseSpecifies if the modifier described by this object represents the interface flag.- Specified by:
isInterfacein interfaceModifierReviewable.ForTypeDefinition- Overrides:
isInterfacein classModifierReviewable.AbstractBase- Returns:
trueif the modifier described by this object represents the interface flag.
-
isAnnotation
public boolean isAnnotation()
Description copied from class:ModifierReviewable.AbstractBaseSpecifies 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.
-
getGenericSignature
@MaybeNull public java.lang.String getGenericSignature()
Description copied from class:TypeDescription.AbstractBaseReturns the generic signature of this byte code element. If this element does not reference generic types or references malformed generic types,nullis returned as a signature.- Specified by:
getGenericSignaturein interfaceNamedElement.WithDescriptor- Overrides:
getGenericSignaturein classTypeDescription.AbstractBase- Returns:
- The generic signature or
nullif this element is not generic.
-
getActualModifiers
public int getActualModifiers(boolean superFlag)
Description copied from class:TypeDescription.AbstractBaseReturns 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 asfinalas it is also done by the Java compiler.- Specified by:
getActualModifiersin interfaceTypeDescription- Overrides:
getActualModifiersin classTypeDescription.AbstractBase- Parameters:
superFlag-trueif 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.
-
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:
trueif this type is a Java record.
-
isSealed
public boolean isSealed()
Description copied from class:TypeDescription.AbstractBaseReturnstrueif this class is a sealed class that only permitts a specified range of subclasses.- Specified by:
isSealedin interfaceTypeDescription- Overrides:
isSealedin classTypeDescription.AbstractBase- Returns:
trueif this class is a sealed class that only permitts a specified range of subclasses.
-
getPermittedSubtypes
public TypeList getPermittedSubtypes()
Returns the list of permitted direct subclasses if this class is a sealed class. Permitted subclasses might or might not be resolvable, where unresolvable subclasses might also be missing from the list. For returned types, methods that return the class's name will always be invokable without errors. If this type is not sealed, an empty list is returned. Note that an empty list might also be returned for a sealed type, if no type permitted subtype is resolvable.- Returns:
- The list of permitted subtypes or an empty list if this type is not sealed.
-
getClassFileVersion
@MaybeNull public ClassFileVersion getClassFileVersion()
Description copied from class:TypeDescription.AbstractBaseAttempts to resolve the class file version of this type. If this description is not based on a class file or if the class file version cannot be resolved,nullis returned.- Specified by:
getClassFileVersionin interfaceTypeDescription- Overrides:
getClassFileVersionin classTypeDescription.AbstractBase- Returns:
- This type's class file version or
nullif it cannot be resolved.
-
-