Top Description Fields Constructors Methods
net.bytebuddy.dynamic.scaffold.inline

public Class DecoratingDynamicTypeBuilder<T>

extends DynamicType.Builder.AbstractBase.UsingTypeWriter<T>
Class Inheritance
Annotations
@Enhance
Type Parameters
<T>
A loaded type that the built type is guaranteed to be a subclass of.
Imports
net.bytebuddy.ClassFileVersion, net.bytebuddy.asm.AsmVisitorWrapper, net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.description.annotation.AnnotationDescription, net.bytebuddy.description.field.FieldDescription, net.bytebuddy.description.method.MethodDescription, net.bytebuddy.description.modifier.ModifierContributor, net.bytebuddy.description.type.RecordComponentDescription, .TypeDefinition, .TypeDescription, .TypeVariableToken, net.bytebuddy.dynamic.ClassFileLocator, .DynamicType, .Transformer, net.bytebuddy.dynamic.scaffold.ClassWriterStrategy, .MethodGraph, .TypeValidation, .TypeWriter, net.bytebuddy.implementation.Implementation, .LoadedTypeInitializer, net.bytebuddy.implementation.attribute.AnnotationRetention, .AnnotationValueFilter, .TypeAttributeAppender, net.bytebuddy.implementation.auxiliary.AuxiliaryType, net.bytebuddy.implementation.bytecode.ByteCodeAppender, net.bytebuddy.matcher.ElementMatcher, .LatentMatcher, net.bytebuddy.pool.TypePool, net.bytebuddy.utility.CompoundList, java.util.ArrayList, .Collection, .Collections, .List

A type builder that decorates a type by allowing for the application of attribute changes and ASM visitor wrappers.

Field Summary

Modifier and TypeField and Description
private final AnnotationRetention
annotationRetention

The annotation retention to apply.

private final AnnotationValueFilter.Factory
annotationValueFilterFactory

The annotation value filter factory to apply.

private final AsmVisitorWrapper
asmVisitorWrapper

The ASM visitor wrapper to apply onto the class writer.

private final AuxiliaryType.NamingStrategy
auxiliaryTypeNamingStrategy

The naming strategy for auxiliary types to apply.

private final List<DynamicType>
auxiliaryTypes

A list of explicitly required auxiliary types.

private final ClassFileLocator
classFileLocator

The class file locator for locating the original type's class file.

private final ClassFileVersion
classFileVersion

The class file version to define auxiliary types in.

private final ClassWriterStrategy
classWriterStrategy

The class writer strategy to use.

private final LatentMatcher<? super MethodDescription>
ignoredMethods

A matcher for identifying methods that should be excluded from instrumentation.

private final Implementation.Context.Factory
implementationContextFactory

The implementation context factory to apply.

private final TypeDescription
instrumentedType

The instrumented type to decorate.

private final MethodGraph.Compiler
methodGraphCompiler

The method graph compiler to use.

private final TypeAttributeAppender
typeAttributeAppender

The type attribute appender to apply onto the instrumented type.

private final TypeValidation
typeValidation

Determines if a type should be explicitly validated.

Constructor Summary

AccessConstructor and Description
public
DecoratingDynamicTypeBuilder(TypeDescription
The instrumented type to decorate.
instrumentedType
,
ClassFileVersion
The class file version to define auxiliary types in.
classFileVersion
,
AuxiliaryType.NamingStrategy
The naming strategy for auxiliary types to apply.
auxiliaryTypeNamingStrategy
,
AnnotationValueFilter.Factory
The annotation value filter factory to apply.
annotationValueFilterFactory
,
AnnotationRetention
The annotation retention to apply.
annotationRetention
,
Implementation.Context.Factory
The implementation context factory to apply.
implementationContextFactory
,
MethodGraph.Compiler
The method graph compiler to use.
methodGraphCompiler
,
TypeValidation
Determines if a type should be explicitly validated.
typeValidation
,
ClassWriterStrategy
The class writer strategy to use.
classWriterStrategy
,
LatentMatcher<? super MethodDescription>
A matcher for identifying methods that should be excluded from instrumentation.
ignoredMethods
,
ClassFileLocator
The class file locator for locating the original type's class file.
classFileLocator
)

Creates a new decorating dynamic type builder.

protected
DecoratingDynamicTypeBuilder(TypeDescription
The instrumented type to decorate.
instrumentedType
,
TypeAttributeAppender
The type attribute appender to apply onto the instrumented type.
typeAttributeAppender
,
AsmVisitorWrapper
The ASM visitor wrapper to apply onto the class writer.
asmVisitorWrapper
,
ClassFileVersion
The class file version to define auxiliary types in.
classFileVersion
,
AuxiliaryType.NamingStrategy
The naming strategy for auxiliary types to apply.
auxiliaryTypeNamingStrategy
,
AnnotationValueFilter.Factory
The annotation value filter factory to apply.
annotationValueFilterFactory
,
AnnotationRetention
The annotation retention to apply.
annotationRetention
,
Implementation.Context.Factory
The implementation context factory to apply.
implementationContextFactory
,
MethodGraph.Compiler
The method graph compiler to use.
methodGraphCompiler
,
TypeValidation
Determines if a type should be explicitly validated.
typeValidation
,
ClassWriterStrategy
The class writer strategy to use.
classWriterStrategy
,
LatentMatcher<? super MethodDescription>
A matcher for identifying methods that should be excluded from instrumentation.
ignoredMethods
,
List<DynamicType>
A list of explicitly required auxiliary types.
auxiliaryTypes
,
ClassFileLocator
The class file locator for locating the original type's class file.
classFileLocator
)

Creates a new decorating dynamic type builder.

Method Summary

Modifier and TypeMethod and Description
public DynamicType.Builder<T>
annotateType(Collection<? extends AnnotationDescription>
The annotations to add to the instrumented type.
annotations
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.annotateType.

Annotates the instrumented type with the supplied annotations.
public DynamicType.Builder<T>
attribute(TypeAttributeAppender
The type attribute appender to apply.
typeAttributeAppender
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.attribute.

Applies the given type attribute appender onto the instrumented type.
public DynamicType.Builder<T>
declaredTypes(Collection<? extends TypeDescription>
The types being declared.
types
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.declaredTypes.

Defines this type as an the outer type of the supplied types.

public DynamicType.Builder.MethodDefinition.ParameterDefinition.Initial<T>
defineConstructor(int
The constructor's modifiers.
modifiers
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.defineConstructor.

Defines the specified constructor to be declared by the instrumented type.
public DynamicType.Builder.FieldDefinition.Optional.Valuable<T>
defineField(String
The name of the field.
name
,
TypeDefinition
The type of the field. Can also be net.bytebuddy.dynamic.TargetType if the field type should be equal to the currently instrumented type.
type
,
int
The modifiers of the field.
modifiers
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.defineField.

Defines the specified field as a field of the built dynamic type.
public DynamicType.Builder.MethodDefinition.ParameterDefinition.Initial<T>
defineMethod(String
The name of the method.
name
,
TypeDefinition
The method's return type. Can also be net.bytebuddy.dynamic.TargetType if the return type should be equal to the currently instrumented type.
returnType
,
int
The method's modifiers.
modifiers
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.defineMethod.

Defines the specified method to be declared by the instrumented type.
public DynamicType.Builder.RecordComponentDefinition.Optional<T>
defineRecordComponent(String
The record component's name.
name
,
TypeDefinition
The record component's type.
type
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.defineRecordComponent.

Defines a new record component.
public DynamicType.Builder.FieldDefinition.Valuable<T>
field(LatentMatcher<? super FieldDescription>
The matcher that determines what declared fields are affected by the subsequent specification.
matcher
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.field.

Matches a field that is already declared by the instrumented type.

public DynamicType.Builder<T>
ignoreAlso(LatentMatcher<? super MethodDescription>
The matcher for determining what methods to exclude from instrumentation.
ignoredMethods
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.ignoreAlso.

Specifies to exclude any method that is matched by the supplied matcher from instrumentation.

public DynamicType.Builder.MethodDefinition.ImplementationDefinition.Optional<T>
implement(Collection<? extends TypeDefinition>
The interface types to implement.
interfaceTypes
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.implement.

Implements the supplied interfaces for the instrumented type.

public DynamicType.Builder<T>
initializer(ByteCodeAppender
The byte code appender to execute within the instrumented type's type initializer.
byteCodeAppender
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.initializer.

Executes the supplied byte code appender within the beginning of the instrumented type's type initializer.

public DynamicType.Builder<T>
initializer(LoadedTypeInitializer
The loaded type initializer to execute upon loading the instrumented type.
loadedTypeInitializer
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.initializer.

Executes the supplied loaded type initializer when loading the created instrumented type.
public DynamicType.Builder.InnerTypeDefinition.ForType<T>
innerTypeOf(TypeDescription
The type to declare as the built type's outer type.
type
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.innerTypeOf.

Defines this type as an inner type of the supplied type.

public DynamicType.Builder.InnerTypeDefinition<T>
innerTypeOf(MethodDescription.InDefinedShape
The method or constructor to declare as the built type's declaring method.
methodDescription
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.innerTypeOf.

Defines this type as an inner type that was declared within the supplied method or constructor.

public DynamicType.Builder.MethodDefinition.ImplementationDefinition<T>
invokable(LatentMatcher<? super MethodDescription>
The matcher that determines what declared methods or constructors are affected by the subsequent specification.
matcher
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.invokable.

Matches a method or constructor that is already declared or inherited by the instrumented type.

public DynamicType.Builder<T>
merge(Collection<? extends ModifierContributor.ForType>
The modifiers of the instrumented type.
modifierContributors
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.merge.

Merges the supplied modifier contributors with the modifiers of the instrumented type and defines them as the instrumented type's new modifiers.
public DynamicType.Builder<T>
modifiers(int
The modifiers of the instrumented type.
modifiers
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.modifiers.

Defines the supplied modifiers as the modifiers of the instrumented type.
public DynamicType.Builder<T>
name(String
The fully qualified name of the generated class in a binary format.
name
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.name.

Names the dynamic type by the supplied name.
public DynamicType.Builder<T>
nestHost(TypeDescription
The nest host.
type
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.nestHost.

Defines this type as a nest member of the supplied type as a nest host.

public DynamicType.Builder<T>
nestMembers(Collection<? extends TypeDescription>
The nest members.
types
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.nestMembers.

Defines this type as a nest host for the supplied types.

public DynamicType.Builder<T>
permittedSubclass(Collection<? extends TypeDescription>
The permitted subclasses.
types
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.permittedSubclass.

Defines this type to allow the supplied permitted subclasses additionally to any prior permitted subclasses.
public DynamicType.Builder.RecordComponentDefinition<T>
recordComponent(LatentMatcher<? super RecordComponentDescription>
The matcher that determines what declared record components are affected by the subsequent specification.
matcher
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.recordComponent.

Matches a record component that is already declared by the instrumented type.

public DynamicType.Builder<T>
require(Collection<DynamicType>
The required dynamic types.
auxiliaryTypes
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.require.

Explicitly requires other dynamic types for the creation of this type.
public DynamicType.Builder<T>
suffix(String
The suffix to append to the current type name.
suffix
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.suffix.

Adds a suffix to the current type name without changing the type's package.
public DynamicType.Builder<T>
topLevelType()

Implements net.bytebuddy.dynamic.DynamicType.Builder.topLevelType.

Defines this type as a top-level type that is not declared by another type or enclosed by another member.

public TypeDescription
protected TypeWriter<T>
protected TypeWriter<T>
public DynamicType.Builder<T>
transform(ElementMatcher<? super TypeDescription.Generic>
The matcher to decide what type variables to transform.
matcher
,
Transformer<TypeVariableToken>
The transformer to apply to the matched type variables.
transformer
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.transform.

Transforms any type variable that is defined by this type if it is matched by the supplied matcher.
public DynamicType.Builder.TypeVariableDefinition<T>
typeVariable(String
The type variable's symbol.
symbol
,
Collection<? extends TypeDefinition>
The type variable's upper bounds. Can also be net.bytebuddy.dynamic.TargetType if the bound type should be equal to the currently instrumented type.
bounds
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.typeVariable.

Defines the supplied type variable with the given bound as a type variable of the instrumented type.
public DynamicType.Builder<T>
public DynamicType.Builder<T>
visit(AsmVisitorWrapper
The ASM visitor wrapper to apply during
asmVisitorWrapper
)

Implements net.bytebuddy.dynamic.DynamicType.Builder.visit.

Applies the supplied AsmVisitorWrapper onto the net.bytebuddy.jar.asm.ClassVisitor during building a dynamic type.
Inherited from net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.UsingTypeWriter:
makemakewrapwrap