public static class InstrumentedType.Default extends TypeDescription.AbstractBase.OfSimpleType implements InstrumentedType.WithFlexibleName
TypeDescription.AbstractBase.OfSimpleType.WithDelegationTypeDescription.AbstractBase.OfSimpleTypeInstrumentedType.Default, InstrumentedType.Factory, InstrumentedType.Frozen, InstrumentedType.Prepareable, InstrumentedType.WithFlexibleNameTypeDescription.AbstractBase, TypeDescription.ArrayProjection, TypeDescription.ForLoadedType, TypeDescription.ForPackageDescription, TypeDescription.Generic, TypeDescription.Latent, TypeDescription.LazyProxy, TypeDescription.SuperTypeLoadingTypeDefinition.Sort, TypeDefinition.SuperClassIteratorModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumerationByteCodeElement.Member, ByteCodeElement.Token<T extends ByteCodeElement.Token<T>>, ByteCodeElement.TypeDependant<T extends ByteCodeElement.TypeDependant<?,S>,S extends ByteCodeElement.Token<S>>NamedElement.WithDescriptor, NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeNameDeclaredByType.WithMandatoryDeclarationAnnotationSource.Empty, AnnotationSource.ExplicitTypeVariableSource.Visitor<T>RAW_TYPESARRAY_INTERFACES, CLASS, OBJECT, STRING, THROWABLE, UNDEFINED, VOIDRAW_TYPES_PROPERTYEMPTY_MASKNON_GENERIC_SIGNATUREEMPTY_NAME, NO_NAME| Modifier | Constructor and Description |
|---|---|
protected |
Default(String name,
int modifiers,
TypeDescription.Generic superClass,
List<? extends TypeVariableToken> typeVariables,
List<? extends TypeDescription.Generic> interfaceTypes,
List<? extends FieldDescription.Token> fieldTokens,
Map<String,Object> auxiliaryFieldValues,
List<? extends MethodDescription.Token> methodTokens,
List<? extends RecordComponentDescription.Token> recordComponentTokens,
List<? extends AnnotationDescription> annotationDescriptions,
TypeInitializer typeInitializer,
LoadedTypeInitializer loadedTypeInitializer,
TypeDescription declaringType,
MethodDescription.InDefinedShape enclosingMethod,
TypeDescription enclosingType,
List<? extends TypeDescription> declaredTypes,
List<? extends TypeDescription> permittedSubclasses,
boolean anonymousClass,
boolean localClass,
boolean record,
TypeDescription nestHost,
List<? extends TypeDescription> nestMembers)
Creates a new instrumented type.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
TypeList.Generic |
getInterfaces()
Returns the interfaces that this type implements.
|
LoadedTypeInitializer |
getLoadedTypeInitializer()
Returns the
LoadedTypeInitializers that were registered
for this instrumented type. |
int |
getModifiers()
Returns the modifier that is described by this object.
|
String |
getName()
Returns the binary name 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 or
null if the described type
is a primitive type or an array. |
TypeList |
getPermittedSubtypes()
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.Generic |
getSuperClass()
Returns the super class of this type.
|
TypeInitializer |
getTypeInitializer()
Returns this instrumented type's type initializer.
|
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.
|
boolean |
isSealed()
Returns
true if this class is a sealed class that only permitts a specified range of subclasses. |
static InstrumentedType |
of(String name,
TypeDescription.Generic superClass,
int modifiers)
Creates a new instrumented type.
|
static InstrumentedType |
of(String name,
TypeDescription.Generic superClass,
ModifierContributor.ForType... modifierContributor)
Creates a new instrumented type.
|
TypeDescription |
validated()
Validates the instrumented type to define a legal Java type.
|
InstrumentedType.WithFlexibleName |
withAnnotations(List<? extends AnnotationDescription> annotationDescriptions)
Creates a new instrumented type with the given annotations.
|
InstrumentedType.WithFlexibleName |
withAnonymousClass(boolean anonymousClass)
Creates a new instrumented type that indicates that it is defined as an anonymous class.
|
InstrumentedType.WithFlexibleName |
withAuxiliaryField(FieldDescription.Token token,
Object value)
Creates a new instrumented type that includes a new field.
|
InstrumentedType.WithFlexibleName |
withDeclaredTypes(TypeList declaredTypes)
Creates a new instrumented type that indicates that it declared the supplied types.
|
InstrumentedType.WithFlexibleName |
withDeclaringType(TypeDescription declaringType)
Creates a new instrumented type that is declared by the supplied type.
|
InstrumentedType.WithFlexibleName |
withEnclosingMethod(MethodDescription.InDefinedShape enclosingMethod)
Creates a new instrumented type with the supplied enclosing method.
|
InstrumentedType.WithFlexibleName |
withEnclosingType(TypeDescription enclosingType)
Creates a new instrumented type with the supplied enclosing type.
|
InstrumentedType.WithFlexibleName |
withField(FieldDescription.Token token)
Creates a new instrumented type that includes a new field.
|
InstrumentedType.WithFlexibleName |
withInitializer(ByteCodeAppender byteCodeAppender)
Creates a new instrumented type that executes the given initializer in the instrumented type's
type initializer.
|
InstrumentedType.WithFlexibleName |
withInitializer(LoadedTypeInitializer loadedTypeInitializer)
Creates a new instrumented type that includes the given
LoadedTypeInitializer. |
InstrumentedType.WithFlexibleName |
withInterfaces(TypeList.Generic interfaceTypes)
Creates a new instrumented type with the given interfaces implemented.
|
InstrumentedType.WithFlexibleName |
withLocalClass(boolean localClass)
Creates a new instrumented type that indicates that is defined as a local class.
|
InstrumentedType.WithFlexibleName |
withMethod(MethodDescription.Token token)
Creates a new instrumented type that includes a new method or constructor.
|
InstrumentedType.WithFlexibleName |
withModifiers(int modifiers)
Creates a new instrumented type with changed modifiers.
|
InstrumentedType.WithFlexibleName |
withName(String name)
Creates a new instrumented type with a changed name.
|
InstrumentedType.WithFlexibleName |
withNestHost(TypeDescription nestHost)
Creates a new instrumented type with the supplied nest host.
|
InstrumentedType.WithFlexibleName |
withNestMembers(TypeList nestMembers)
Creates a new instrumented types with the supplied nest members added to this instrumented type.
|
InstrumentedType.WithFlexibleName |
withPermittedSubclasses(TypeList permittedSubclasses)
Creates a new instrumented type that includes the supplied permitted subclasses or unseals the type.
|
InstrumentedType.WithFlexibleName |
withRecord(boolean record)
Creates a new instrumented type that indicates that it defined as a record type.
|
InstrumentedType.WithFlexibleName |
withRecordComponent(RecordComponentDescription.Token token)
Creates a new instrumented type that includes a new record component.
|
InstrumentedType.WithFlexibleName |
withTypeVariable(TypeVariableToken typeVariable)
Creates a new instrumented type with the given type variable defined.
|
InstrumentedType.WithFlexibleName |
withTypeVariables(ElementMatcher<? super TypeDescription.Generic> matcher,
Transformer<TypeVariableToken> transformer)
Applies a transformation onto all existing type variables of this instrumented type.
|
getCanonicalName, getComponentType, getDescriptor, getSimpleName, getStackSize, isArray, isPrimitiveaccept, asBoxed, asErasure, asGenericType, asUnboxed, equals, getActualModifiers, getActualName, getClassFileVersion, getDefaultValue, getEnclosingSource, getGenericSignature, getInheritedAnnotations, getInnerClassCount, getInternalName, getLongSimpleName, 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, isVisibleTo, iterator, represents, toSafeString, toStringfindExpectedVariable, findVariablegetEnumerationState, 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, isVolatileclone, finalize, getClass, notify, notifyAll, wait, wait, waitasBoxed, asUnboxed, getActualModifiers, getCanonicalName, getClassFileVersion, getComponentType, getDefaultValue, getInheritedAnnotations, getInnerClassCount, getLongSimpleName, getSimpleName, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isAssignableFrom, isAssignableFrom, isAssignableTo, isAssignableTo, isCompileTimeConstant, isInHierarchyWith, isInHierarchyWith, isInnerClass, isInstance, isMemberType, isNestedClass, isNestHost, isNestMateOf, isNestMateOf, isPackageType, isPrimitiveWrapper, isSamePackageasErasure, asGenericType, getSort, getStackSize, getTypeName, isArray, isPrimitive, representsgetTypeManifestation, isAnnotation, isInterfaceisAbstractgetEnumerationState, isEnumgetOwnership, getVisibility, isDeprecated, isPackagePrivate, isPrivate, isProtected, isPublic, isStaticgetSyntheticState, isFinal, isSyntheticforEach, iterator, spliteratorisAccessibleTo, isVisibleTogetInternalNamegetDescriptor, getGenericSignaturegetActualNameaccept, findExpectedVariable, findVariable, getEnclosingSource, isGenerified, isInferrableprotected Default(String name, int modifiers, @MaybeNull TypeDescription.Generic superClass, List<? extends TypeVariableToken> typeVariables, List<? extends TypeDescription.Generic> interfaceTypes, List<? extends FieldDescription.Token> fieldTokens, Map<String,Object> auxiliaryFieldValues, List<? extends MethodDescription.Token> methodTokens, List<? extends RecordComponentDescription.Token> recordComponentTokens, List<? extends AnnotationDescription> annotationDescriptions, TypeInitializer typeInitializer, LoadedTypeInitializer loadedTypeInitializer, @MaybeNull TypeDescription declaringType, @MaybeNull MethodDescription.InDefinedShape enclosingMethod, @MaybeNull TypeDescription enclosingType, List<? extends TypeDescription> declaredTypes, @MaybeNull List<? extends TypeDescription> permittedSubclasses, boolean anonymousClass, boolean localClass, boolean record, TypeDescription nestHost, List<? extends TypeDescription> nestMembers)
name - The binary name of the instrumented type.modifiers - The modifiers of the instrumented type.typeVariables - The instrumented type's type variables in their tokenized form.superClass - The generic super type of the instrumented type.interfaceTypes - A list of interfaces of the instrumented type.fieldTokens - A list of field tokens describing the fields of the instrumented type.auxiliaryFieldValues - A mapping of auxiliary field names to their mapped values.methodTokens - A list of method tokens describing the methods of the instrumented type.recordComponentTokens - A list of record component tokens describing the record components of the instrumented type.annotationDescriptions - A list of annotations of the annotated type.typeInitializer - The type initializer of the instrumented type.loadedTypeInitializer - The loaded type initializer of the instrumented type.declaringType - The declaring type of the instrumented type or null if no such type exists.enclosingMethod - The enclosing method of the instrumented type or null if no such type exists.enclosingType - The enclosing type of the instrumented type or null if no such type exists.declaredTypes - A list of types that are declared by this type.permittedSubclasses - A list of permitted subclasses or null if this type is not sealed.anonymousClass - true if this type is an anonymous class.localClass - true if this type is a local class.record - true if this type is a record class.nestHost - The nest host of this instrumented type or a description of TargetType if this type is its own nest host.nestMembers - A list of all members of this types nest group excluding this type.public static InstrumentedType of(String name, TypeDescription.Generic superClass, ModifierContributor.ForType... modifierContributor)
name - The type's name.superClass - The type's super class.modifierContributor - The type's modifiers.public static InstrumentedType of(String name, TypeDescription.Generic superClass, int modifiers)
name - The type's name.superClass - The type's super class.modifiers - The type's modifiers.public InstrumentedType.WithFlexibleName withModifiers(int modifiers)
withModifiers in interface InstrumentedTypewithModifiers in interface InstrumentedType.WithFlexibleNamemodifiers - The instrumented type's modifiers.public InstrumentedType.WithFlexibleName withField(FieldDescription.Token token)
withField in interface InstrumentedTypewithField in interface InstrumentedType.WithFlexibleNametoken - A token that represents the field's shape.public InstrumentedType.WithFlexibleName withAuxiliaryField(FieldDescription.Token token, Object value)
withAuxiliaryField in interface InstrumentedTypewithAuxiliaryField in interface InstrumentedType.WithFlexibleNametoken - A token that represents the field's shape.value - The value that this assigned to this field.public InstrumentedType.WithFlexibleName withMethod(MethodDescription.Token token)
withMethod in interface InstrumentedTypewithMethod in interface InstrumentedType.WithFlexibleNametoken - A token that represents the method's shape.public InstrumentedType.WithFlexibleName withRecordComponent(RecordComponentDescription.Token token)
withRecordComponent in interface InstrumentedTypewithRecordComponent in interface InstrumentedType.WithFlexibleNametoken - A token that represents the record component's shape.public InstrumentedType.WithFlexibleName withInterfaces(TypeList.Generic interfaceTypes)
withInterfaces in interface InstrumentedTypewithInterfaces in interface InstrumentedType.WithFlexibleNameinterfaceTypes - The interface types to implement.public InstrumentedType.WithFlexibleName withAnnotations(List<? extends AnnotationDescription> annotationDescriptions)
withAnnotations in interface InstrumentedTypewithAnnotations in interface InstrumentedType.WithFlexibleNameannotationDescriptions - The annotations to add to the instrumented type.public InstrumentedType.WithFlexibleName withNestHost(TypeDescription nestHost)
withNestHost in interface InstrumentedTypewithNestHost in interface InstrumentedType.WithFlexibleNamenestHost - The nest host of the created instrumented type.public InstrumentedType.WithFlexibleName withNestMembers(TypeList nestMembers)
withNestMembers in interface InstrumentedTypewithNestMembers in interface InstrumentedType.WithFlexibleNamenestMembers - The nest members to add to the created instrumented type.public InstrumentedType.WithFlexibleName withEnclosingType(@MaybeNull TypeDescription enclosingType)
withEnclosingType in interface InstrumentedTypewithEnclosingType in interface InstrumentedType.WithFlexibleNameenclosingType - The type to define as the created instrumented type's enclosing type.public InstrumentedType.WithFlexibleName withEnclosingMethod(MethodDescription.InDefinedShape enclosingMethod)
withEnclosingMethod in interface InstrumentedTypewithEnclosingMethod in interface InstrumentedType.WithFlexibleNameenclosingMethod - The method to define as the created instrumented type's enclosing method.public InstrumentedType.WithFlexibleName withDeclaringType(@MaybeNull TypeDescription declaringType)
withDeclaringType in interface InstrumentedTypewithDeclaringType in interface InstrumentedType.WithFlexibleNamedeclaringType - The type that declares the instrumented type or null if no such type exists.public InstrumentedType.WithFlexibleName withDeclaredTypes(TypeList declaredTypes)
withDeclaredTypes in interface InstrumentedTypewithDeclaredTypes in interface InstrumentedType.WithFlexibleNamedeclaredTypes - The types to add to the created instrumented type as declared types.public InstrumentedType.WithFlexibleName withPermittedSubclasses(@MaybeNull TypeList permittedSubclasses)
withPermittedSubclasses in interface InstrumentedTypewithPermittedSubclasses in interface InstrumentedType.WithFlexibleNamepermittedSubclasses - A list of permitted subclasses to include or null to unseal the type.public InstrumentedType.WithFlexibleName withTypeVariable(TypeVariableToken typeVariable)
withTypeVariable in interface InstrumentedTypewithTypeVariable in interface InstrumentedType.WithFlexibleNametypeVariable - The type variable to declare.public InstrumentedType.WithFlexibleName withName(String name)
withName in interface InstrumentedType.WithFlexibleNamename - The name of the instrumented type.public InstrumentedType.WithFlexibleName withTypeVariables(ElementMatcher<? super TypeDescription.Generic> matcher, Transformer<TypeVariableToken> transformer)
withTypeVariables in interface InstrumentedType.WithFlexibleNamematcher - The matcher to decide what type variables to transform.transformer - The transformer to apply on all matched type variables.public InstrumentedType.WithFlexibleName withLocalClass(boolean localClass)
withLocalClass in interface InstrumentedTypewithLocalClass in interface InstrumentedType.WithFlexibleNamelocalClass - true if the instrumented type is supposed to be treated as a local class.public InstrumentedType.WithFlexibleName withAnonymousClass(boolean anonymousClass)
withAnonymousClass in interface InstrumentedTypewithAnonymousClass in interface InstrumentedType.WithFlexibleNameanonymousClass - true if the instrumented type is supposed to be treated as an anonymous class.public InstrumentedType.WithFlexibleName withRecord(boolean record)
withRecord in interface InstrumentedTypewithRecord in interface InstrumentedType.WithFlexibleNamerecord - true if the instrumented type is supposed to be a record.public InstrumentedType.WithFlexibleName withInitializer(LoadedTypeInitializer loadedTypeInitializer)
LoadedTypeInitializer.withInitializer in interface InstrumentedTypewithInitializer in interface InstrumentedType.WithFlexibleNameloadedTypeInitializer - The type initializer to include.public InstrumentedType.WithFlexibleName withInitializer(ByteCodeAppender byteCodeAppender)
withInitializer in interface InstrumentedTypewithInitializer in interface InstrumentedType.WithFlexibleNamebyteCodeAppender - The byte code to add to the type initializer.public LoadedTypeInitializer getLoadedTypeInitializer()
LoadedTypeInitializers that were registered
for this instrumented type.getLoadedTypeInitializer in interface InstrumentedTypepublic TypeInitializer getTypeInitializer()
getTypeInitializer in interface InstrumentedType@MaybeNull public MethodDescription.InDefinedShape getEnclosingMethod()
null is returned by this method.getEnclosingMethod in interface TypeDescriptionnull if there is no such method.@MaybeNull public TypeDescription getEnclosingType()
getEnclosingType in interface TypeDescriptionnull if there is no such type.public TypeList getDeclaredTypes()
getDeclaredTypes in interface TypeDescriptionpublic boolean isAnonymousType()
isAnonymousType in interface TypeDescriptiontrue if this type description represents an anonymous type.public boolean isLocalType()
isLocalType in interface TypeDescriptiontrue if this type description represents a local type.@MaybeNull public PackageDescription getPackage()
null if the described type
is a primitive type or an array.getPackage in interface TypeDescriptionnull if the described type
is a primitive type or an array.public AnnotationList getDeclaredAnnotations()
getDeclaredAnnotations in interface AnnotationSource@MaybeNull public TypeDescription getDeclaringType()
getDeclaringType in interface DeclaredByTypegetDeclaringType in interface TypeDescriptionnull if no such type exists.@MaybeNull public TypeDescription.Generic getSuperClass()
TypeDefinition.Sort.NON_GENERIC),
parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types. Interface types
and the Object class do not define a super class where null is returned. Array types define Object
as their direct super class.getSuperClass in interface TypeDefinitionnull if no super class exists for this type.public TypeList.Generic getInterfaces()
TypeDefinition.Sort.NON_GENERIC),
parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types.getInterfaces in interface TypeDefinitionpublic FieldList<FieldDescription.InDefinedShape> getDeclaredFields()
TypeDefinition.Sort.NON_GENERIC),
parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types. Generic array
types never define fields and the returned list is always empty for such types.getDeclaredFields in interface TypeDefinitiongetDeclaredFields in interface TypeDescriptionTypeDefinition.Sort.NON_GENERIC),
parameterized types (TypeDefinition.Sort.PARAMETERIZED) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY) types. Generic array
types never define methods and the returned list is always empty for such types.public MethodList<MethodDescription.InDefinedShape> getDeclaredMethods()
getDeclaredMethods in interface TypeDefinitiongetDeclaredMethods in interface TypeDescriptionpublic TypeList.Generic getTypeVariables()
getTypeVariables in interface TypeVariableSourcepublic int getModifiers()
getModifiers in interface ModifierReviewablepublic String getName()
getName in interface NamedElement.WithRuntimeNamepublic TypeDescription getNestHost()
getNestHost in interface TypeDescriptionpublic TypeList getNestMembers()
getNestMembers in interface TypeDescriptionpublic RecordComponentList<RecordComponentDescription.InDefinedShape> getRecordComponents()
getRecordComponents in interface TypeDefinitiongetRecordComponents in interface TypeDescriptionpublic boolean isRecord()
isRecord in interface TypeDefinitiontrue if this type is a Java record.public boolean isSealed()
TypeDescription.AbstractBasetrue if this class is a sealed class that only permitts a specified range of subclasses.isSealed in interface TypeDescriptionisSealed in class TypeDescription.AbstractBasetrue if this class is a sealed class that only permitts a specified range of subclasses.public TypeList getPermittedSubtypes()
getPermittedSubtypes in interface TypeDescriptionpublic TypeDescription validated()
validated in interface InstrumentedTypeCopyright © 2014–2025. All rights reserved.