Top Description Inners Fields Constructors Methods
net.bytebuddy.dynamic.scaffold.subclass

public Class SubclassDynamicTypeBuilder<T>

extends DynamicType.Builder.AbstractBase.Adapter<T>
Class Inheritance
Annotations
@Enhance
Type Parameters
<T>
A loaded type that the dynamic type is guaranteed to be a subtype of.
Imports
net.bytebuddy.ClassFileVersion, net.bytebuddy.asm.AsmVisitorWrapper, net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.description.method.MethodDescription, net.bytebuddy.description.type.TypeDescription, net.bytebuddy.dynamic.DynamicType, .VisibilityBridgeStrategy, net.bytebuddy.dynamic.scaffold.*, net.bytebuddy.implementation.Implementation, net.bytebuddy.implementation.attribute.AnnotationRetention, .AnnotationValueFilter, .TypeAttributeAppender, net.bytebuddy.implementation.auxiliary.AuxiliaryType, net.bytebuddy.matcher.ElementMatcher, .LatentMatcher, net.bytebuddy.pool.TypePool, java.util.Collections, .List

A type builder that creates an instrumented type as a subclass, i.e. a type that is not based on an existing class file.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
SubclassDynamicTypeBuilder.InstrumentableMatcher

A matcher that locates all methods that are overridable and not ignored or that are directly defined on the instrumented type.

Field Summary

Modifier and TypeField and Description
private final ConstructorStrategy
constructorStrategy

The constructor strategy to apply onto the instrumented type.

Inherited from net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.Adapter:
annotationRetentionannotationValueFilterFactoryasmVisitorWrapperauxiliaryTypeNamingStrategyauxiliaryTypesclassFileVersionclassWriterStrategyfieldRegistryignoredMethodsimplementationContextFactoryinstrumentedTypemethodGraphCompilermethodRegistryrecordComponentRegistrytypeAttributeAppendertypeValidationvisibilityBridgeStrategy

Constructor Summary

AccessConstructor and Description
public
SubclassDynamicTypeBuilder(InstrumentedType.WithFlexibleName
An instrumented type representing the subclass.
instrumentedType
,
ClassFileVersion
The class file version to use for types that are not based on an existing class file.
classFileVersion
,
AuxiliaryType.NamingStrategy
The naming strategy to use for naming auxiliary types.
auxiliaryTypeNamingStrategy
,
AnnotationValueFilter.Factory
The annotation value filter factory to use.
annotationValueFilterFactory
,
AnnotationRetention
The annotation retention strategy to use.
annotationRetention
,
Implementation.Context.Factory
The implementation context factory to use.
implementationContextFactory
,
MethodGraph.Compiler
The method graph compiler to use.
methodGraphCompiler
,
TypeValidation
Determines if a type should be explicitly validated.
typeValidation
,
VisibilityBridgeStrategy
The visibility bridge strategy to apply.
visibilityBridgeStrategy
,
ClassWriterStrategy
The class writer strategy to use.
classWriterStrategy
,
LatentMatcher<? super MethodDescription>
A matcher for identifying methods that should be excluded from instrumentation.
ignoredMethods
,
ConstructorStrategy
The constructor strategy to apply onto the instrumented type.
constructorStrategy
)

Creates a new type builder for creating a subclass.

protected
SubclassDynamicTypeBuilder(InstrumentedType.WithFlexibleName
An instrumented type representing the subclass.
instrumentedType
,
FieldRegistry
The field registry to use.
fieldRegistry
,
MethodRegistry
The method registry to use.
methodRegistry
,
RecordComponentRegistry
The record component registry to use.
recordComponentRegistry
,
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 use for types that are not based on an existing class file.
classFileVersion
,
AuxiliaryType.NamingStrategy
The naming strategy to use for naming auxiliary types.
auxiliaryTypeNamingStrategy
,
AnnotationValueFilter.Factory
The annotation value filter factory to use.
annotationValueFilterFactory
,
AnnotationRetention
The annotation retention strategy to use.
annotationRetention
,
Implementation.Context.Factory
The implementation context factory to use.
implementationContextFactory
,
MethodGraph.Compiler
The method graph compiler to use.
methodGraphCompiler
,
TypeValidation
Determines if a type should be explicitly validated.
typeValidation
,
VisibilityBridgeStrategy
The visibility bridge strategy to apply.
visibilityBridgeStrategy
,
ClassWriterStrategy
The class writer strategy to use.
classWriterStrategy
,
LatentMatcher<? super MethodDescription>
A matcher for identifying methods that should be excluded from instrumentation.
ignoredMethods
,
List<? extends DynamicType>
A list of explicitly required auxiliary types.
auxiliaryTypes
,
ConstructorStrategy
The constructor strategy to apply onto the instrumented type.
constructorStrategy
)

Creates a new type builder for creating a subclass.

Method Summary

Modifier and TypeMethod and Description
private InstrumentedType

Returns:

The instrumented type with the constructor strategy applied onto.
applyConstructorStrategy
(InstrumentedType
The instrumented type to apply the constructor onto.
instrumentedType
)

Applies this builder's constructor strategy to the given instrumented type.

protected DynamicType.Builder<T>
materialize(InstrumentedType.WithFlexibleName
The instrumented type.
instrumentedType
,
FieldRegistry
The current field registry.
fieldRegistry
,
MethodRegistry
The current method registry.
methodRegistry
,
RecordComponentRegistry
The record component pool to use.
recordComponentRegistry
,
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
The type validation state.
typeValidation
,
VisibilityBridgeStrategy
The visibility bridge strategy to apply.
visibilityBridgeStrategy
,
ClassWriterStrategy
The class writer strategy to use.
classWriterStrategy
,
LatentMatcher<? super MethodDescription>
A matcher for identifying methods that should be excluded from instrumentation.
ignoredMethods
,
List<? extends DynamicType>
A list of explicitly required auxiliary types.
auxiliaryTypes
)

Implements abstract net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.Adapter.materialize.

Materializes the supplied state of a dynamic type builder.
protected TypeWriter<T>
protected TypeWriter<T>
Inherited from net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.Adapter:
annotateTypeattributedeclaredTypesdefineConstructordefineFielddefineMethoddefineRecordComponentfieldignoreAlsoimplementinitializerinitializerinnerTypeOfinnerTypeOfinvokablemergemodifiersnamenestHostnestMemberspermittedSubclassrecordComponentrequiresuffixtopLevelTypetoTypeDescriptiontransformtypeVariableunsealedvisit

Field Detail

constructorStrategyback to summary
private final ConstructorStrategy constructorStrategy

The constructor strategy to apply onto the instrumented type.

Constructor Detail

SubclassDynamicTypeBuilderback to summary
public SubclassDynamicTypeBuilder(InstrumentedType.WithFlexibleName instrumentedType, ClassFileVersion classFileVersion, AuxiliaryType.NamingStrategy auxiliaryTypeNamingStrategy, AnnotationValueFilter.Factory annotationValueFilterFactory, AnnotationRetention annotationRetention, Implementation.Context.Factory implementationContextFactory, MethodGraph.Compiler methodGraphCompiler, TypeValidation typeValidation, VisibilityBridgeStrategy visibilityBridgeStrategy, ClassWriterStrategy classWriterStrategy, LatentMatcher<? super MethodDescription> ignoredMethods, ConstructorStrategy constructorStrategy)

Creates a new type builder for creating a subclass.

Parameters
instrumentedType:InstrumentedType.WithFlexibleName

An instrumented type representing the subclass.

classFileVersion:ClassFileVersion

The class file version to use for types that are not based on an existing class file.

auxiliaryTypeNamingStrategy:AuxiliaryType.NamingStrategy

The naming strategy to use for naming auxiliary types.

annotationValueFilterFactory:AnnotationValueFilter.Factory

The annotation value filter factory to use.

annotationRetention:AnnotationRetention

The annotation retention strategy to use.

implementationContextFactory:Implementation.Context.Factory

The implementation context factory to use.

methodGraphCompiler:MethodGraph.Compiler

The method graph compiler to use.

typeValidation:TypeValidation

Determines if a type should be explicitly validated.

visibilityBridgeStrategy:VisibilityBridgeStrategy

The visibility bridge strategy to apply.

classWriterStrategy:ClassWriterStrategy

The class writer strategy to use.

ignoredMethods:LatentMatcher<? super MethodDescription>

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

constructorStrategy:ConstructorStrategy

The constructor strategy to apply onto the instrumented type.

SubclassDynamicTypeBuilderback to summary
protected SubclassDynamicTypeBuilder(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, ClassWriterStrategy classWriterStrategy, LatentMatcher<? super MethodDescription> ignoredMethods, List<? extends DynamicType> auxiliaryTypes, ConstructorStrategy constructorStrategy)

Creates a new type builder for creating a subclass.

Parameters
instrumentedType:InstrumentedType.WithFlexibleName

An instrumented type representing the subclass.

fieldRegistry:FieldRegistry

The field registry to use.

methodRegistry:MethodRegistry

The method registry to use.

recordComponentRegistry:RecordComponentRegistry

The record component registry to use.

typeAttributeAppender:TypeAttributeAppender

The type attribute appender to apply onto the instrumented type.

asmVisitorWrapper:AsmVisitorWrapper

The ASM visitor wrapper to apply onto the class writer.

classFileVersion:ClassFileVersion

The class file version to use for types that are not based on an existing class file.

auxiliaryTypeNamingStrategy:AuxiliaryType.NamingStrategy

The naming strategy to use for naming auxiliary types.

annotationValueFilterFactory:AnnotationValueFilter.Factory

The annotation value filter factory to use.

annotationRetention:AnnotationRetention

The annotation retention strategy to use.

implementationContextFactory:Implementation.Context.Factory

The implementation context factory to use.

methodGraphCompiler:MethodGraph.Compiler

The method graph compiler to use.

typeValidation:TypeValidation

Determines if a type should be explicitly validated.

visibilityBridgeStrategy:VisibilityBridgeStrategy

The visibility bridge strategy to apply.

classWriterStrategy:ClassWriterStrategy

The class writer strategy to use.

ignoredMethods:LatentMatcher<? super MethodDescription>

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

auxiliaryTypes:List<? extends DynamicType>

A list of explicitly required auxiliary types.

constructorStrategy:ConstructorStrategy

The constructor strategy to apply onto the instrumented type.

Method Detail

applyConstructorStrategyback to summary
private InstrumentedType applyConstructorStrategy(InstrumentedType instrumentedType)

Applies this builder's constructor strategy to the given instrumented type.

Parameters
instrumentedType:InstrumentedType

The instrumented type to apply the constructor onto.

Returns:InstrumentedType

The instrumented type with the constructor strategy applied onto.

materializeback to summary
protected DynamicType.Builder<T> 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, ClassWriterStrategy classWriterStrategy, LatentMatcher<? super MethodDescription> ignoredMethods, List<? extends DynamicType> auxiliaryTypes)

Implements abstract net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.Adapter.materialize.

Doc from net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.Adapter.materialize.

Materializes the supplied state of a dynamic type builder.

Parameters
instrumentedType:InstrumentedType.WithFlexibleName

The instrumented type.

fieldRegistry:FieldRegistry

The current field registry.

methodRegistry:MethodRegistry

The current method registry.

recordComponentRegistry:RecordComponentRegistry

The record component pool to use.

typeAttributeAppender:TypeAttributeAppender

The type attribute appender to apply onto the instrumented type.

asmVisitorWrapper:AsmVisitorWrapper

The ASM visitor wrapper to apply onto the class writer.

classFileVersion:ClassFileVersion

The class file version to define auxiliary types in.

auxiliaryTypeNamingStrategy:AuxiliaryType.NamingStrategy

The naming strategy for auxiliary types to apply.

annotationValueFilterFactory:AnnotationValueFilter.Factory

The annotation value filter factory to apply.

annotationRetention:AnnotationRetention

The annotation retention to apply.

implementationContextFactory:Implementation.Context.Factory

The implementation context factory to apply.

methodGraphCompiler:MethodGraph.Compiler

The method graph compiler to use.

typeValidation:TypeValidation

The type validation state.

visibilityBridgeStrategy:VisibilityBridgeStrategy

The visibility bridge strategy to apply.

classWriterStrategy:ClassWriterStrategy

The class writer strategy to use.

ignoredMethods:LatentMatcher<? super MethodDescription>

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

auxiliaryTypes:List<? extends DynamicType>

A list of explicitly required auxiliary types.

Returns:DynamicType.Builder<T>

A type builder that represents the supplied arguments.

Annotations
@Override
toTypeWriterback to summary
protected TypeWriter<T> toTypeWriter()

Implements abstract net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.UsingTypeWriter.toTypeWriter.

Doc from net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.UsingTypeWriter.toTypeWriter.

Creates a TypeWriter without an explicitly specified TypePool.

Returns:TypeWriter<T>

An appropriate TypeWriter.

toTypeWriterback to summary
protected TypeWriter<T> toTypeWriter(TypePool typePool)

Implements abstract net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.UsingTypeWriter.toTypeWriter.

Doc from net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.UsingTypeWriter.toTypeWriter.

Creates a TypeWriter given the specified TypePool.

Parameters
typePool:TypePool

The TypePool to use.

Returns:TypeWriter<T>

An appropriate TypeWriter.

net.bytebuddy.dynamic.scaffold.subclass back to summary

protected Class SubclassDynamicTypeBuilder.InstrumentableMatcher

extends Object
implements LatentMatcher<MethodDescription>
Class Inheritance
  • java.lang.Object
  • net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.InstrumentableMatcher
All Implemented Interfaces
net.bytebuddy.matcher.LatentMatcher
Annotations
@Enhance

A matcher that locates all methods that are overridable and not ignored or that are directly defined on the instrumented type.

Field Summary

Modifier and TypeField and Description
private final LatentMatcher<? super MethodDescription>
ignoredMethods

A matcher for the ignored methods.

Constructor Summary

AccessConstructor and Description
protected
InstrumentableMatcher(LatentMatcher<? super MethodDescription>
A matcher for the ignored methods.
ignoredMethods
)

Creates a latent method matcher that matches all methods that are to be instrumented by a SubclassDynamicTypeBuilder.

Method Summary

Modifier and TypeMethod and Description
public ElementMatcher<? super MethodDescription>
resolve(TypeDescription
The type description for which the represented matcher should be resolved.
typeDescription
)

Implements net.bytebuddy.matcher.LatentMatcher.resolve.

Resolves the element matcher this instance represents for the supplied type description.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ignoredMethodsback to summary
private final LatentMatcher<? super MethodDescription> ignoredMethods

A matcher for the ignored methods.

Constructor Detail

InstrumentableMatcherback to summary
protected InstrumentableMatcher(LatentMatcher<? super MethodDescription> ignoredMethods)

Creates a latent method matcher that matches all methods that are to be instrumented by a SubclassDynamicTypeBuilder.

Parameters
ignoredMethods:LatentMatcher<? super MethodDescription>

A matcher for the ignored methods.

Method Detail

resolveback to summary
public ElementMatcher<? super MethodDescription> resolve(TypeDescription typeDescription)

Implements net.bytebuddy.matcher.LatentMatcher.resolve.

Doc from net.bytebuddy.matcher.LatentMatcher.resolve.

Resolves the element matcher this instance represents for the supplied type description.

Parameters
typeDescription:TypeDescription

The type description for which the represented matcher should be resolved.

Returns:ElementMatcher<? super MethodDescription>

An ElementMatcher that represents this matcher's resolved form.