Package net.bytebuddy.dynamic.scaffold
Interface InstrumentedType
- All Superinterfaces:
AnnotationSource
,ByteCodeElement
,DeclaredByType
,Iterable<TypeDefinition>
,ModifierReviewable
,ModifierReviewable.ForTypeDefinition
,ModifierReviewable.OfAbstraction
,ModifierReviewable.OfByteCodeElement
,ModifierReviewable.OfEnumeration
,NamedElement
,NamedElement.WithDescriptor
,NamedElement.WithRuntimeName
,TypeDefinition
,TypeDescription
,TypeVariableSource
- All Known Subinterfaces:
InstrumentedType.WithFlexibleName
- All Known Implementing Classes:
InstrumentedType.Default
,InstrumentedType.Frozen
Implementations of this interface represent an instrumented type that is subject to change. Implementations
should however be immutable and return new instance when its builder methods are invoked.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
A default implementation of an instrumented type.static interface
A factory for creating anInstrumentedType
.static class
A frozen representation of an instrumented type of which the structure must not be modified.static interface
Implementations are able to prepare anInstrumentedType
.static interface
Implementations represent anInstrumentedType
with a flexible name.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.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.LazyProxy, TypeDescription.SuperTypeLoading
Nested classes/interfaces inherited from interface net.bytebuddy.description.TypeVariableSource
TypeVariableSource.Visitor<T>
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionReturns theLoadedTypeInitializer
s that were registered for this instrumented type.Returns this instrumented type's type initializer.Validates the instrumented type to define a legal Java type.withAnnotations
(List<? extends AnnotationDescription> annotationDescriptions) Creates a new instrumented type with the given annotations.withAnonymousClass
(boolean anonymousClass) Creates a new instrumented type that indicates that it is defined as an anonymous class.withAuxiliaryField
(FieldDescription.Token token, Object value) Creates a new instrumented type that includes a new field.withDeclaredTypes
(TypeList declaredTypes) Creates a new instrumented type that indicates that it declared the supplied types.withDeclaringType
(TypeDescription declaringType) Creates a new instrumented type that is declared by the supplied type.withEnclosingMethod
(MethodDescription.InDefinedShape enclosingMethod) Creates a new instrumented type with the supplied enclosing method.withEnclosingType
(TypeDescription enclosingType) Creates a new instrumented type with the supplied enclosing type.withField
(FieldDescription.Token token) Creates a new instrumented type that includes a new field.withInitializer
(ByteCodeAppender byteCodeAppender) Creates a new instrumented type that executes the given initializer in the instrumented type's type initializer.withInitializer
(LoadedTypeInitializer loadedTypeInitializer) Creates a new instrumented type that includes the givenLoadedTypeInitializer
.withInterfaces
(TypeList.Generic interfaceTypes) Creates a new instrumented type with the given interfaces implemented.withLocalClass
(boolean localClass) Creates a new instrumented type that indicates that is defined as a local class.Creates a new instrumented type that includes a new method or constructor.withModifiers
(int modifiers) Creates a new instrumented type with changed modifiers.withNestHost
(TypeDescription nestHost) Creates a new instrumented type with the supplied nest host.withNestMembers
(TypeList nestMembers) Creates a new instrumented types with the supplied nest members added to this instrumented type.withPermittedSubclasses
(TypeList permittedSubclasses) Creates a new instrumented type that includes the supplied permitted subclasses or unseals the type.withRecord
(boolean record) Creates a new instrumented type that indicates that it defined as a record type.Creates a new instrumented type that includes a new record component.withTypeVariable
(TypeVariableToken typeVariable) Creates a new instrumented type with the given type variable defined.Methods inherited from interface net.bytebuddy.description.annotation.AnnotationSource
getDeclaredAnnotations
Methods inherited from interface net.bytebuddy.description.ByteCodeElement
isAccessibleTo, isVisibleTo
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface net.bytebuddy.description.ModifierReviewable
getModifiers, 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.NamedElement
getActualName
Methods inherited from interface net.bytebuddy.description.NamedElement.WithDescriptor
getDescriptor, getGenericSignature
Methods inherited from interface net.bytebuddy.description.NamedElement.WithRuntimeName
getInternalName, getName
Methods inherited from interface net.bytebuddy.description.type.TypeDefinition
asErasure, asGenericType, getInterfaces, getSort, getStackSize, getSuperClass, getTypeName, isArray, isPrimitive, isRecord, represents
Methods inherited from interface net.bytebuddy.description.type.TypeDescription
asBoxed, asUnboxed, getActualModifiers, getCanonicalName, getClassFileVersion, getComponentType, getDeclaredFields, getDeclaredMethods, getDeclaredTypes, getDeclaringType, getDefaultValue, getEnclosingMethod, getEnclosingType, getInheritedAnnotations, getInnerClassCount, getLongSimpleName, getNestHost, getNestMembers, getPackage, getPermittedSubtypes, getRecordComponents, getSimpleName, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isAnonymousType, isAssignableFrom, isAssignableFrom, isAssignableTo, isAssignableTo, isCompileTimeConstant, isInHierarchyWith, isInHierarchyWith, isInnerClass, isInstance, isLocalType, isMemberType, isNestedClass, isNestHost, isNestMateOf, isNestMateOf, isPackageType, isPrimitiveWrapper, isSamePackage, isSealed
Methods inherited from interface net.bytebuddy.description.TypeVariableSource
accept, findExpectedVariable, findVariable, getEnclosingSource, getTypeVariables, isGenerified, isInferrable
-
Method Details
-
withField
Creates a new instrumented type that includes a new field.- Parameters:
token
- A token that represents the field's shape.- Returns:
- A new instrumented type that is equal to this instrumented type but with the additional field.
-
withAuxiliaryField
Creates a new instrumented type that includes a new field.- Parameters:
token
- A token that represents the field's shape.value
- The value that this assigned to this field.- Returns:
- A new instrumented type that is equal to this instrumented type but with the additional field.
-
withMethod
Creates a new instrumented type that includes a new method or constructor.- Parameters:
token
- A token that represents the method's shape.- Returns:
- A new instrumented type that is equal to this instrumented type but with the additional method.
-
withRecordComponent
Creates a new instrumented type that includes a new record component.- Parameters:
token
- A token that represents the record component's shape.- Returns:
- A new instrumented type that is equal to this instrumented type but with the additional record component.
-
withModifiers
Creates a new instrumented type with changed modifiers.- Parameters:
modifiers
- The instrumented type's modifiers.- Returns:
- A new instrumented type that is equal to this instrumented type but with the given modifiers.
-
withInterfaces
Creates a new instrumented type with the given interfaces implemented.- Parameters:
interfaceTypes
- The interface types to implement.- Returns:
- A new instrumented type that is equal to this instrumented type but with the given interfaces implemented.
-
withTypeVariable
Creates a new instrumented type with the given type variable defined.- Parameters:
typeVariable
- The type variable to declare.- Returns:
- A new instrumented type that is equal to this instrumented type but with the given type variable declared.
-
withAnnotations
Creates a new instrumented type with the given annotations.- Parameters:
annotationDescriptions
- The annotations to add to the instrumented type.- Returns:
- A new instrumented type that is equal to this instrumented type but annotated with the given annotations
-
withNestHost
Creates a new instrumented type with the supplied nest host. An instrumented type can be its own nest host. Setting a nest host removes all nest members from the instrumented type.- Parameters:
nestHost
- The nest host of the created instrumented type.- Returns:
- A new instrumented type with the supplied type as its nest host.
-
withNestMembers
Creates a new instrumented types with the supplied nest members added to this instrumented type. The instrumented type is defined as a nest host if this method is invoked. Any previous nest members are prepended to the supplied types.- Parameters:
nestMembers
- The nest members to add to the created instrumented type.- Returns:
- A new instrumented type that applies the supplied nest members.
-
withEnclosingType
Creates a new instrumented type with the supplied enclosing type.- Parameters:
enclosingType
- The type to define as the created instrumented type's enclosing type.- Returns:
- A new instrumented type with the supplied type as its enclosing type.
-
withEnclosingMethod
Creates a new instrumented type with the supplied enclosing method.- Parameters:
enclosingMethod
- The method to define as the created instrumented type's enclosing method.- Returns:
- A new instrumented type with the supplied method as its enclosing method.
-
withDeclaringType
Creates a new instrumented type that is declared by the supplied type.- Parameters:
declaringType
- The type that declares the instrumented type ornull
if no such type exists.- Returns:
- A new instrumented type that is declared by the instrumented type.
-
withDeclaredTypes
Creates a new instrumented type that indicates that it declared the supplied types.- Parameters:
declaredTypes
- The types to add to the created instrumented type as declared types.- Returns:
- A new instrumented type that indicates that it has declared the supplied types.
-
withPermittedSubclasses
Creates a new instrumented type that includes the supplied permitted subclasses or unseals the type.- Parameters:
permittedSubclasses
- A list of permitted subclasses to include ornull
to unseal the type.- Returns:
- A new instrumented type that includes the supplied permitted subclasses or unseals the type.
-
withLocalClass
Creates a new instrumented type that indicates that is defined as a local class. Setting this property resets the anonymous class property.- Parameters:
localClass
-true
if the instrumented type is supposed to be treated as a local class.- Returns:
- A new instrumented type that is treated as a local class.
-
withAnonymousClass
Creates a new instrumented type that indicates that it is defined as an anonymous class. Setting this property resets the local class property.- Parameters:
anonymousClass
-true
if the instrumented type is supposed to be treated as an anonymous class.- Returns:
- A new instrumented type that is treated as an anonymous class.
-
withRecord
Creates a new instrumented type that indicates that it defined as a record type. Setting this property to false removes all record components.- Parameters:
record
-true
if the instrumented type is supposed to be a record.- Returns:
- A new instrumented type that is defined as a record.
-
withInitializer
Creates a new instrumented type that includes the givenLoadedTypeInitializer
.- Parameters:
loadedTypeInitializer
- The type initializer to include.- Returns:
- A new instrumented type that is equal to this instrumented type but with the additional type initializer.
-
withInitializer
Creates a new instrumented type that executes the given initializer in the instrumented type's type initializer.- Parameters:
byteCodeAppender
- The byte code to add to the type initializer.- Returns:
- A new instrumented type that is equal to this instrumented type but with the given stack manipulation attached to its type initializer.
-
getLoadedTypeInitializer
LoadedTypeInitializer getLoadedTypeInitializer()Returns theLoadedTypeInitializer
s that were registered for this instrumented type.- Returns:
- The registered loaded type initializers for this instrumented type.
-
getTypeInitializer
TypeInitializer getTypeInitializer()Returns this instrumented type's type initializer.- Returns:
- This instrumented type's type initializer.
-
validated
TypeDescription validated()Validates the instrumented type to define a legal Java type.- Returns:
- This instrumented type as a non-modifiable type description.
-