U
- A loaded type that the built type is guaranteed to be a subclass of.@HashCodeAndEqualsPlugin.Enhance public abstract static class DynamicType.Builder.AbstractBase.Adapter<U> extends DynamicType.Builder.AbstractBase.UsingTypeWriter<U>
Modifier and Type | Class and Description |
---|---|
protected class |
DynamicType.Builder.AbstractBase.Adapter.FieldDefinitionAdapter
An adapter for defining a new field.
|
protected class |
DynamicType.Builder.AbstractBase.Adapter.FieldMatchAdapter
An adapter for matching an existing field.
|
protected class |
DynamicType.Builder.AbstractBase.Adapter.InnerTypeDefinitionForMethodAdapter
An adapter for applying an inner type definition for an outer method or constructor.
|
protected class |
DynamicType.Builder.AbstractBase.Adapter.InnerTypeDefinitionForTypeAdapter
An adapter for applying an inner type definition for an outer type.
|
protected class |
DynamicType.Builder.AbstractBase.Adapter.MethodDefinitionAdapter
An adapter for defining a new method.
|
protected class |
DynamicType.Builder.AbstractBase.Adapter.MethodMatchAdapter
An adapter for matching an existing method.
|
protected class |
DynamicType.Builder.AbstractBase.Adapter.OptionalMethodMatchAdapter
An adapter for optionally matching methods defined by declared interfaces.
|
protected class |
DynamicType.Builder.AbstractBase.Adapter.RecordComponentDefinitionAdapter
An adapter for defining a record component.
|
protected class |
DynamicType.Builder.AbstractBase.Adapter.RecordComponentMatchAdapter
An adapter for matching record components.
|
protected class |
DynamicType.Builder.AbstractBase.Adapter.TypeVariableDefinitionAdapter
An adapter for defining a new type variable for the instrumented type.
|
DynamicType.Builder.AbstractBase.Adapter<U>, DynamicType.Builder.AbstractBase.Delegator<U>, DynamicType.Builder.AbstractBase.UsingTypeWriter<U>
DynamicType.Builder.AbstractBase<S>, DynamicType.Builder.FieldDefinition<S>, DynamicType.Builder.InnerTypeDefinition<S>, DynamicType.Builder.MethodDefinition<S>, DynamicType.Builder.RecordComponentDefinition<S>, DynamicType.Builder.TypeVariableDefinition<S>
Modifier and Type | Field and Description |
---|---|
protected AnnotationRetention |
annotationRetention
The annotation retention to apply.
|
protected AnnotationValueFilter.Factory |
annotationValueFilterFactory
The annotation value filter factory to apply.
|
protected AsmVisitorWrapper |
asmVisitorWrapper
The ASM visitor wrapper to apply onto the class writer.
|
protected AuxiliaryType.NamingStrategy |
auxiliaryTypeNamingStrategy
The naming strategy for auxiliary types to apply.
|
protected List<? extends DynamicType> |
auxiliaryTypes
A list of explicitly defined auxiliary types.
|
protected ClassFileVersion |
classFileVersion
The class file version to define auxiliary types in.
|
protected AsmClassReader.Factory |
classReaderFactory
The class reader factory to use.
|
protected AsmClassWriter.Factory |
classWriterFactory
The class writer factory to use.
|
protected FieldRegistry |
fieldRegistry
The current field registry.
|
protected LatentMatcher<? super MethodDescription> |
ignoredMethods
A matcher for identifying methods that should be excluded from instrumentation.
|
protected Implementation.Context.Factory |
implementationContextFactory
The implementation context factory to apply.
|
protected InstrumentedType.WithFlexibleName |
instrumentedType
The instrumented type to be created.
|
protected MethodGraph.Compiler |
methodGraphCompiler
The method graph compiler to use.
|
protected MethodRegistry |
methodRegistry
The current method registry.
|
protected RecordComponentRegistry |
recordComponentRegistry
The current record component registry.
|
protected TypeAttributeAppender |
typeAttributeAppender
The type attribute appender to apply onto the instrumented type.
|
protected TypeValidation |
typeValidation
Determines if a type should be explicitly validated.
|
protected VisibilityBridgeStrategy |
visibilityBridgeStrategy
The visibility bridge strategy to apply.
|
Modifier | Constructor and Description |
---|---|
protected |
Adapter(InstrumentedType.WithFlexibleName instrumentedType,
FieldRegistry fieldRegistry,
MethodRegistry methodRegistry,
RecordComponentRegistry recordComponentRegistry,
TypeAttributeAppender typeAttributeAppender,
AsmVisitorWrapper asmVisitorWrapper,
ClassFileVersion classFileVersion,
AuxiliaryType.NamingStrategy auxiliaryTypeNamingStrategy,
AnnotationValueFilter.Factory annotationValueFilterFactory,
AnnotationRetention annotationRetention,
Implementation.Context.Factory implementationContextFactory,
MethodGraph.Compiler methodGraphCompiler,
TypeValidation typeValidation,
VisibilityBridgeStrategy visibilityBridgeStrategy,
AsmClassReader.Factory classReaderFactory,
AsmClassWriter.Factory classWriterFactory,
LatentMatcher<? super MethodDescription> ignoredMethods,
List<? extends DynamicType> auxiliaryTypes)
Creates a new default type writer for creating a new type that is not based on an existing class file.
|
Modifier and Type | Method and Description |
---|---|
DynamicType.Builder<U> |
annotateType(Collection<? extends AnnotationDescription> annotations)
Annotates the instrumented type with the supplied annotations.
|
DynamicType.Builder<U> |
attribute(TypeAttributeAppender typeAttributeAppender)
Applies the given type attribute appender onto the instrumented type.
|
DynamicType.Builder<U> |
declaredTypes(Collection<? extends TypeDescription> types)
Defines this type as an the outer type of the supplied types.
|
DynamicType.Builder.MethodDefinition.ParameterDefinition.Initial<U> |
defineConstructor(int modifiers)
Defines the specified constructor to be declared by the instrumented type.
|
DynamicType.Builder.FieldDefinition.Optional.Valuable<U> |
defineField(String name,
TypeDefinition type,
int modifiers)
Defines the specified field as a field of the built dynamic type.
|
DynamicType.Builder.MethodDefinition.ParameterDefinition.Initial<U> |
defineMethod(String name,
TypeDefinition returnType,
int modifiers)
Defines the specified method to be declared by the instrumented type.
|
DynamicType.Builder.RecordComponentDefinition.Optional<U> |
defineRecordComponent(String name,
TypeDefinition type)
Defines a new record component.
|
DynamicType.Builder.FieldDefinition.Valuable<U> |
field(LatentMatcher<? super FieldDescription> matcher)
Matches a field that is already declared by the instrumented type.
|
DynamicType.Builder<U> |
ignoreAlso(LatentMatcher<? super MethodDescription> ignoredMethods)
Specifies to exclude any method that is matched by the supplied matcher from instrumentation.
|
DynamicType.Builder.MethodDefinition.ImplementationDefinition.Optional<U> |
implement(Collection<? extends TypeDefinition> interfaceTypes)
Implements the supplied interfaces for the instrumented type.
|
DynamicType.Builder<U> |
initializer(ByteCodeAppender byteCodeAppender)
Executes the supplied byte code appender within the beginning of the instrumented type's type initializer.
|
DynamicType.Builder<U> |
initializer(LoadedTypeInitializer loadedTypeInitializer)
Executes the supplied loaded type initializer when loading the created instrumented type.
|
DynamicType.Builder.InnerTypeDefinition<U> |
innerTypeOf(MethodDescription.InDefinedShape methodDescription)
Defines this type as an inner type that was declared within the supplied method or constructor.
|
DynamicType.Builder.InnerTypeDefinition.ForType<U> |
innerTypeOf(TypeDescription type)
Defines this type as an inner type of the supplied type.
|
DynamicType.Builder.MethodDefinition.ImplementationDefinition<U> |
invokable(LatentMatcher<? super MethodDescription> matcher)
Matches a method or constructor that is already declared or inherited by the instrumented type.
|
protected abstract DynamicType.Builder<U> |
materialize(InstrumentedType.WithFlexibleName instrumentedType,
FieldRegistry fieldRegistry,
MethodRegistry methodRegistry,
RecordComponentRegistry recordComponentRegistry,
TypeAttributeAppender typeAttributeAppender,
AsmVisitorWrapper asmVisitorWrapper,
ClassFileVersion classFileVersion,
AuxiliaryType.NamingStrategy auxiliaryTypeNamingStrategy,
AnnotationValueFilter.Factory annotationValueFilterFactory,
AnnotationRetention annotationRetention,
Implementation.Context.Factory implementationContextFactory,
MethodGraph.Compiler methodGraphCompiler,
TypeValidation typeValidation,
VisibilityBridgeStrategy visibilityBridgeStrategy,
AsmClassReader.Factory classReaderFactory,
AsmClassWriter.Factory classWriterFactory,
LatentMatcher<? super MethodDescription> ignoredMethods,
List<? extends DynamicType> auxiliaryTypes)
Materializes the supplied state of a dynamic type builder.
|
DynamicType.Builder<U> |
merge(Collection<? extends ModifierContributor.ForType> modifierContributors)
Merges the supplied modifier contributors with the modifiers of the instrumented type and defines them as the instrumented
type's new modifiers.
|
DynamicType.Builder<U> |
modifiers(int modifiers)
Defines the supplied modifiers as the modifiers of the instrumented type.
|
DynamicType.Builder<U> |
name(String name)
Names the dynamic type by the supplied name.
|
DynamicType.Builder<U> |
nestHost(TypeDescription type)
Defines this type as a nest member of the supplied type as a nest host.
|
DynamicType.Builder<U> |
nestMembers(Collection<? extends TypeDescription> types)
Defines this type as a nest host for the supplied types.
|
DynamicType.Builder<U> |
permittedSubclass(Collection<? extends TypeDescription> types)
Defines this type to allow the supplied permitted subclasses additionally to any prior permitted subclasses.
|
DynamicType.Builder.RecordComponentDefinition<U> |
recordComponent(LatentMatcher<? super RecordComponentDescription> matcher)
Matches a record component that is already declared by the instrumented type.
|
DynamicType.Builder<U> |
require(Collection<DynamicType> auxiliaryTypes)
Explicitly requires other dynamic types for the creation of this type.
|
DynamicType.Builder<U> |
suffix(String suffix)
Adds a suffix to the current type name without changing the type's package.
|
DynamicType.Builder<U> |
topLevelType()
Defines this type as a top-level type that is not declared by another type or enclosed by another member.
|
TypeDescription |
toTypeDescription()
Returns a
TypeDescription for the currently built type. |
DynamicType.Builder<U> |
transform(ElementMatcher<? super TypeDescription.Generic> matcher,
Transformer<TypeVariableToken> transformer)
Transforms any type variable that is defined by this type if it is matched by the supplied matcher.
|
DynamicType.Builder.TypeVariableDefinition<U> |
typeVariable(String symbol,
Collection<? extends TypeDefinition> bounds)
Defines the supplied type variable with the given bound as a type variable of the instrumented type.
|
DynamicType.Builder<U> |
unsealed()
Unseales this type.
|
DynamicType.Builder<U> |
visit(AsmVisitorWrapper asmVisitorWrapper)
Applies the supplied
AsmVisitorWrapper onto the ClassVisitor during building a dynamic type. |
make, make, toTypeWriter, toTypeWriter, wrap, wrap
annotateType, annotateType, annotateType, constructor, declaredTypes, declaredTypes, declaredTypes, define, define, define, define, define, define, defineConstructor, defineConstructor, defineField, defineField, defineField, defineField, defineField, defineMethod, defineMethod, defineMethod, defineMethod, defineMethod, defineProperty, defineProperty, defineProperty, defineProperty, defineRecordComponent, field, ignoreAlso, implement, implement, implement, innerTypeOf, innerTypeOf, innerTypeOf, invokable, make, make, merge, method, modifiers, modifiers, nestHost, nestMembers, nestMembers, nestMembers, noNestMate, permittedSubclass, permittedSubclass, permittedSubclass, recordComponent, require, require, require, serialVersionUid, typeVariable, typeVariable, typeVariable, typeVariable, withHashCodeEquals, withToString, wrap, wrap
protected final InstrumentedType.WithFlexibleName instrumentedType
protected final FieldRegistry fieldRegistry
protected final MethodRegistry methodRegistry
protected final RecordComponentRegistry recordComponentRegistry
protected final TypeAttributeAppender typeAttributeAppender
protected final AsmVisitorWrapper asmVisitorWrapper
protected final ClassFileVersion classFileVersion
protected final AuxiliaryType.NamingStrategy auxiliaryTypeNamingStrategy
protected final AnnotationValueFilter.Factory annotationValueFilterFactory
protected final AnnotationRetention annotationRetention
protected final Implementation.Context.Factory implementationContextFactory
protected final MethodGraph.Compiler methodGraphCompiler
protected final TypeValidation typeValidation
protected final VisibilityBridgeStrategy visibilityBridgeStrategy
protected final AsmClassReader.Factory classReaderFactory
protected final AsmClassWriter.Factory classWriterFactory
protected final LatentMatcher<? super MethodDescription> ignoredMethods
protected final List<? extends DynamicType> auxiliaryTypes
protected Adapter(InstrumentedType.WithFlexibleName instrumentedType, FieldRegistry fieldRegistry, MethodRegistry methodRegistry, RecordComponentRegistry recordComponentRegistry, TypeAttributeAppender typeAttributeAppender, AsmVisitorWrapper asmVisitorWrapper, ClassFileVersion classFileVersion, AuxiliaryType.NamingStrategy auxiliaryTypeNamingStrategy, AnnotationValueFilter.Factory annotationValueFilterFactory, AnnotationRetention annotationRetention, Implementation.Context.Factory implementationContextFactory, MethodGraph.Compiler methodGraphCompiler, TypeValidation typeValidation, VisibilityBridgeStrategy visibilityBridgeStrategy, AsmClassReader.Factory classReaderFactory, AsmClassWriter.Factory classWriterFactory, LatentMatcher<? super MethodDescription> ignoredMethods, List<? extends DynamicType> auxiliaryTypes)
instrumentedType
- The instrumented type to be created.fieldRegistry
- The current field registry.methodRegistry
- The current method registry.recordComponentRegistry
- The record component pool to use.typeAttributeAppender
- The type attribute appender to apply onto the instrumented type.asmVisitorWrapper
- The ASM visitor wrapper to apply onto the class writer.classFileVersion
- The class file version to define auxiliary types in.auxiliaryTypeNamingStrategy
- The naming strategy for auxiliary types to apply.annotationValueFilterFactory
- The annotation value filter factory to apply.annotationRetention
- The annotation retention to apply.implementationContextFactory
- The implementation context factory to apply.methodGraphCompiler
- The method graph compiler to use.typeValidation
- Determines if a type should be explicitly validated.visibilityBridgeStrategy
- The visibility bridge strategy to apply.classReaderFactory
- The class reader factory to use.classWriterFactory
- The class writer factory to use.ignoredMethods
- A matcher for identifying methods that should be excluded from instrumentation.auxiliaryTypes
- A list of explicitly defined auxiliary types.public DynamicType.Builder.FieldDefinition.Optional.Valuable<U> defineField(String name, TypeDefinition type, int modifiers)
name
- The name of the field.type
- The type of the field. Can also be TargetType
if the field type
should be equal to the currently instrumented type.modifiers
- The modifiers of the field.public DynamicType.Builder.FieldDefinition.Valuable<U> field(LatentMatcher<? super FieldDescription> matcher)
Matches a field that is already declared by the instrumented type. This gives opportunity to change that field's
default value, annotations or custom attributes. Using a latent matcher gives opportunity to resolve an
ElementMatcher
based on the instrumented type before applying the matcher.
When a type is redefined or rebased, any annotations that the field declared previously is preserved
as it is if Byte Buddy is configured to retain such annotations by
AnnotationRetention.ENABLED
. If any existing annotations should be
altered, annotation retention must be disabled.
If a field is already matched by a previously specified field matcher, the new field definition gets precedence over the previous definition, i.e. the previous field definition is no longer applied.
matcher
- The matcher that determines what declared fields are affected by the subsequent specification.public DynamicType.Builder.MethodDefinition.ParameterDefinition.Initial<U> defineMethod(String name, TypeDefinition returnType, int modifiers)
name
- The name of the method.returnType
- The method's return type. Can also be TargetType
if the return type
should be equal to the currently instrumented type.modifiers
- The method's modifiers.public DynamicType.Builder.MethodDefinition.ParameterDefinition.Initial<U> defineConstructor(int modifiers)
modifiers
- The constructor's modifiers.public DynamicType.Builder.MethodDefinition.ImplementationDefinition<U> invokable(LatentMatcher<? super MethodDescription> matcher)
Matches a method or constructor that is already declared or inherited by the instrumented type. This gives
opportunity to change or to override that method's or constructor's implementation, default value, annotations
or custom attributes. It is also possible to make a method abstract. Using a latent matcher gives opportunity
to resolve an ElementMatcher
based on the instrumented type before applying the matcher.
When a type is redefined or rebased, any annotations that the method or constructor declared previously is preserved
as it is if Byte Buddy is configured to retain such annotations by
AnnotationRetention.ENABLED
. If any existing annotations should be
altered, annotation retention must be disabled.
If a method or constructor is already matched by a previously specified matcher, the new definition gets precedence over the previous definition, i.e. the previous definition is no longer applied.
Note that the specified definition does never apply for methods that are explicitly ignored.
Important: It is possible to instrument the dynamic type's initializer. Depending on the used TypeResolutionStrategy
,
the type initializer might be run before Byte Buddy could apply any LoadedTypeInitializer
s which are
responsible for preparing the instrumented type prior to the initializer's execution. For preparing the type prior to
executing the initializer, an TypeResolutionStrategy.Active
resolver must be chosen.
matcher
- The matcher that determines what declared methods or constructors are affected by the subsequent specification.public DynamicType.Builder.MethodDefinition.ImplementationDefinition.Optional<U> implement(Collection<? extends TypeDefinition> interfaceTypes)
Implements the supplied interfaces for the instrumented type. Optionally, it is possible to define the methods that are defined by the interfaces or the interfaces' super interfaces. This excludes methods that are explicitly ignored.
Note: This methods implements the supplied types as is, i.e. any TypeDescription
values are
implemented as raw types if they declare type variables or an owner type.
interfaceTypes
- The interface types to implement.public DynamicType.Builder<U> ignoreAlso(LatentMatcher<? super MethodDescription> ignoredMethods)
Specifies to exclude any method that is matched by the supplied matcher from instrumentation. Previously supplied matchers
remain valid after supplying a new matcher, i.e. any method that is matched by a previously supplied matcher is always ignored.
Using a latent matcher gives opportunity to resolve an ElementMatcher
based on the instrumented type before applying the
matcher.
When ignoring a type, previously registered matchers are applied before this matcher. If a previous matcher indicates that a type is to be ignored, this matcher is no longer executed.
ignoredMethods
- The matcher for determining what methods to exclude from instrumentation.public DynamicType.Builder.RecordComponentDefinition.Optional<U> defineRecordComponent(String name, TypeDefinition type)
ByteBuddy.makeRecord()
is used.name
- The record component's name.type
- The record component's type.public DynamicType.Builder.RecordComponentDefinition<U> recordComponent(LatentMatcher<? super RecordComponentDescription> matcher)
Matches a record component that is already declared by the instrumented type. This gives opportunity to change that record component's annotations or custom attributes.
When a type is redefined or rebased, any annotations that the field declared previously is preserved
as it is if Byte Buddy is configured to retain such annotations by
AnnotationRetention.ENABLED
. If any existing annotations should be
altered, annotation retention must be disabled.
If a record component is already matched by a previously specified record component matcher, the new record component definition gets precedence over the previous definition, i.e. the previous record component definition is no longer applied.
matcher
- The matcher that determines what declared record components are affected by the subsequent specification.public DynamicType.Builder<U> initializer(ByteCodeAppender byteCodeAppender)
Executes the supplied byte code appender within the beginning of the instrumented type's type initializer. The supplied byte code appender must not return from the method. If several byte code appenders are supplied, they are executed within their application order.
This method should only be used for preparing an instrumented type with a specific configuration. Normally,
a byte code appender is applied via Byte Buddy's standard API by invoking DynamicType.Builder.invokable(ElementMatcher)
using the ElementMatchers.isTypeInitializer()
matcher.
byteCodeAppender
- The byte code appender to execute within the instrumented type's type initializer.public DynamicType.Builder<U> initializer(LoadedTypeInitializer loadedTypeInitializer)
loadedTypeInitializer
- The loaded type initializer to execute upon loading the instrumented type.public DynamicType.Builder<U> name(String name)
foo.Bar
). A type's package determines what other types are visible to the instrumented type and what methods
can be overridden or be represented in method signatures or as field types.name
- The fully qualified name of the generated class in a binary format.public DynamicType.Builder<U> suffix(String suffix)
suffix
- The suffix to append to the current type name.public DynamicType.Builder<U> modifiers(int modifiers)
modifiers
- The modifiers of the instrumented type.public DynamicType.Builder<U> merge(Collection<? extends ModifierContributor.ForType> modifierContributors)
modifierContributors
- The modifiers of the instrumented type.public DynamicType.Builder<U> topLevelType()
Defines this type as a top-level type that is not declared by another type or enclosed by another member.
Important: Changing the declaration hierarchy of a type has no influence on the nest mate hierarchy.
Warning: By changing this type's declaration, any other type will not change its declaration of enclosing members or declared types about any nesting of a declaration. It is the responsibility of the user of this API to keep such declarations consistent among the definitions of connected types.
public DynamicType.Builder.InnerTypeDefinition.ForType<U> innerTypeOf(TypeDescription type)
Defines this type as an inner type of the supplied type. Without any additional configuration, the type declaration is defined as a local type.
Important: Changing the declaration hierarchy of a type has no influence on the nest mate hierarchy.
Warning: By changing this type's declaration, any other type will not change its declaration of enclosing members or declared types about any nesting of a declaration. It is the responsibility of the user of this API to keep such declarations consistent among the definitions of connected types.
type
- The type to declare as the built type's outer type.public DynamicType.Builder.InnerTypeDefinition<U> innerTypeOf(MethodDescription.InDefinedShape methodDescription)
Defines this type as an inner type that was declared within the supplied method or constructor. Without any additional configuration, the type declaration is defined as a local type.
Important: Changing the declaration hierarchy of a type has no influence on the nest mate hierarchy.
Warning: By changing this type's declaration, any other type will not change its declaration of enclosing members or declared types about any nesting of a declaration. It is the responsibility of the user of this API to keep such declarations consistent among the definitions of connected types.
methodDescription
- The method or constructor to declare as the built type's declaring method.public DynamicType.Builder<U> declaredTypes(Collection<? extends TypeDescription> types)
Defines this type as an the outer type of the supplied types. Using this method, it is possible to add inner type declarations for anonymous or local types which are not normally exposed by type descriptions. Doing so, it is however possible to indicate to Byte Buddy that the required attributes for such an inner type declaration should be added to a class file.
Important: Changing the declaration hierarchy of a type has no influence on the nest mate hierarchy.
Warning: By changing this type's declaration, any other type will not change its declaration of enclosing members or declared types about any nesting of a declaration. It is the responsibility of the user of this API to keep such declarations consistent among the definitions of connected types.
types
- The types being declared.public DynamicType.Builder<U> nestHost(TypeDescription type)
Defines this type as a nest member of the supplied type as a nest host.
Important: Changing the nest mate hierarchy of a type has no influence on the declaration hierarchy.
Warning: Changing nest mate hierarchies always requires changing a member and its host or a host and all its members. Otherwise, the runtime will not accept further nest mates. It is the responsibility of the user of this API to keep such declarations consistent among the definitions of connected types.
type
- The nest host.public DynamicType.Builder<U> nestMembers(Collection<? extends TypeDescription> types)
Defines this type as a nest host for the supplied types.
Important: Changing the nest mate hierarchy of a type has no influence on the declaration hierarchy.
Warning: Changing nest mate hierarchies always requires changing a member and its host or a host and all its members. Otherwise, the runtime will not accept further nest mates. It is the responsibility of the user of this API to keep such declarations consistent among the definitions of connected types.
types
- The nest members.public DynamicType.Builder<U> permittedSubclass(Collection<? extends TypeDescription> types)
types
- The permitted subclasses.public DynamicType.Builder<U> unsealed()
public DynamicType.Builder.TypeVariableDefinition<U> typeVariable(String symbol, Collection<? extends TypeDefinition> bounds)
symbol
- The type variable's symbol.bounds
- The type variable's upper bounds. Can also be TargetType
if the bound type
should be equal to the currently instrumented type.public DynamicType.Builder<U> transform(ElementMatcher<? super TypeDescription.Generic> matcher, Transformer<TypeVariableToken> transformer)
matcher
- The matcher to decide what type variables to transform.transformer
- The transformer to apply to the matched type variables.public DynamicType.Builder<U> attribute(TypeAttributeAppender typeAttributeAppender)
Annotation
s.typeAttributeAppender
- The type attribute appender to apply.public DynamicType.Builder<U> annotateType(Collection<? extends AnnotationDescription> annotations)
annotations
- The annotations to add to the instrumented type.public DynamicType.Builder<U> visit(AsmVisitorWrapper asmVisitorWrapper)
AsmVisitorWrapper
onto the ClassVisitor
during building a dynamic type.
Using an ASM visitor, it is possible to manipulate byte code directly. Byte Buddy does not validate directly created byte code
and it remains the responsibility of the visitor's implementor to generate legal byte code. If several ASM visitor wrappers
are registered, they are applied on top of another in their registration order.asmVisitorWrapper
- The ASM visitor wrapper to apply duringpublic DynamicType.Builder<U> require(Collection<DynamicType> auxiliaryTypes)
auxiliaryTypes
- The required dynamic types.public TypeDescription toTypeDescription()
TypeDescription
for the currently built type.TypeDescription
for the currently built type.protected abstract DynamicType.Builder<U> materialize(InstrumentedType.WithFlexibleName instrumentedType, FieldRegistry fieldRegistry, MethodRegistry methodRegistry, RecordComponentRegistry recordComponentRegistry, TypeAttributeAppender typeAttributeAppender, AsmVisitorWrapper asmVisitorWrapper, ClassFileVersion classFileVersion, AuxiliaryType.NamingStrategy auxiliaryTypeNamingStrategy, AnnotationValueFilter.Factory annotationValueFilterFactory, AnnotationRetention annotationRetention, Implementation.Context.Factory implementationContextFactory, MethodGraph.Compiler methodGraphCompiler, TypeValidation typeValidation, VisibilityBridgeStrategy visibilityBridgeStrategy, AsmClassReader.Factory classReaderFactory, AsmClassWriter.Factory classWriterFactory, LatentMatcher<? super MethodDescription> ignoredMethods, List<? extends DynamicType> auxiliaryTypes)
instrumentedType
- The instrumented type.fieldRegistry
- The current field registry.methodRegistry
- The current method registry.recordComponentRegistry
- The record component pool to use.typeAttributeAppender
- The type attribute appender to apply onto the instrumented type.asmVisitorWrapper
- The ASM visitor wrapper to apply onto the class writer.classFileVersion
- The class file version to define auxiliary types in.auxiliaryTypeNamingStrategy
- The naming strategy for auxiliary types to apply.annotationValueFilterFactory
- The annotation value filter factory to apply.annotationRetention
- The annotation retention to apply.implementationContextFactory
- The implementation context factory to apply.methodGraphCompiler
- The method graph compiler to use.typeValidation
- The type validation state.visibilityBridgeStrategy
- The visibility bridge strategy to apply.classReaderFactory
- The class reader factory to use.classWriterFactory
- The class writer factory to use.ignoredMethods
- A matcher for identifying methods that should be excluded from instrumentation.auxiliaryTypes
- A list of explicitly required auxiliary types.Copyright © 2014–2024. All rights reserved.