U
- The most specific known loaded type that is implemented by the created dynamic type, usually the
type itself, an interface or the direct super class.protected abstract class DynamicType.Builder.AbstractBase.AbstractDelegatingBuilder<U> extends Object implements DynamicType.Builder<U>
DynamicType.Builder.AbstractBase<S>, DynamicType.Builder.ExceptionDeclarableMethodInterception<S>, DynamicType.Builder.FieldAnnotationTarget<S>, DynamicType.Builder.FieldValueTarget<S>, DynamicType.Builder.MatchedMethodInterception<S>, DynamicType.Builder.MethodAnnotationTarget<S>, DynamicType.Builder.OptionalMatchedMethodInterception<S>
Modifier | Constructor and Description |
---|---|
protected |
AbstractDelegatingBuilder() |
Modifier and Type | Method and Description |
---|---|
DynamicType.Builder<U> |
annotateType(Annotation... annotation)
Adds annotations to the currently constructed type.
|
DynamicType.Builder<U> |
annotateType(AnnotationDescription... annotation)
Adds annotations to the currently constructed type.
|
DynamicType.Builder<U> |
attribute(TypeAttributeAppender attributeAppender)
Adds an attribute appender to the currently constructed type which will be applied on the creation of
the type.
|
DynamicType.Builder<U> |
bridgeMethodResolverFactory(BridgeMethodResolver.Factory bridgeMethodResolverFactory)
Defines a bridge method resolver factory to be applied to this type creation.
|
DynamicType.Builder<U> |
classFileVersion(ClassFileVersion classFileVersion)
Defines a class file format version for this builder for which the dynamic types should be created.
|
DynamicType.Builder<U> |
classVisitor(ClassVisitorWrapper classVisitorWrapper)
Adds an additional ASM
ClassVisitor to this builder which will be applied in
the construction process of this dynamic type. |
DynamicType.Builder.MatchedMethodInterception<U> |
constructor(ElementMatcher<? super MethodDescription> methodMatcher)
Selects a set of constructors of this type for implementation.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
define(MethodDescription methodDescription)
Defines a new method or constructor for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineConstructor(Constructor<?> constructor)
Defines a new constructor for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineConstructor(Iterable<Class<?>> parameterTypes,
int modifiers)
Defines a new constructor for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineConstructor(Iterable<Class<?>> parameterTypes,
ModifierContributor.ForMethod... modifier)
Defines a new constructor for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineConstructor(List<? extends TypeDescription> parameterTypes,
int modifiers)
Defines a new constructor for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineConstructor(List<? extends TypeDescription> parameterTypes,
ModifierContributor.ForMethod... modifier)
Defines a new constructor for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineConstructor(MethodDescription methodDescription)
Defines a new constructor for this type.
|
DynamicType.Builder.FieldValueTarget<U> |
defineField(Field field)
Defines a new field for this type.
|
DynamicType.Builder.FieldValueTarget<U> |
defineField(FieldDescription fieldDescription)
Defines a new field for this type.
|
DynamicType.Builder.FieldValueTarget<U> |
defineField(String name,
Class<?> fieldType,
int modifiers)
Defines a new field for this type.
|
DynamicType.Builder.FieldValueTarget<U> |
defineField(String name,
Class<?> fieldType,
ModifierContributor.ForField... modifier)
Defines a new field for this type.
|
DynamicType.Builder.FieldValueTarget<U> |
defineField(String name,
TypeDescription fieldTypeDescription,
int modifiers)
Defines a new field for this type.
|
DynamicType.Builder.FieldValueTarget<U> |
defineField(String name,
TypeDescription fieldTypeDescription,
ModifierContributor.ForField... modifier)
Defines a new field for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineMethod(Method method)
Defines a new method for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineMethod(MethodDescription methodDescription)
Defines a new method for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineMethod(String name,
Class<?> returnType,
List<Class<?>> parameterTypes,
int modifiers)
Defines a new method for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineMethod(String name,
Class<?> returnType,
List<Class<?>> parameterTypes,
ModifierContributor.ForMethod... modifier)
Defines a new method for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineMethod(String name,
TypeDescription returnType,
List<? extends TypeDescription> parameterTypes,
int modifiers)
Defines a new method for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<U> |
defineMethod(String name,
TypeDescription returnType,
List<? extends TypeDescription> parameterTypes,
ModifierContributor.ForMethod... modifier)
Defines a new method for this type.
|
DynamicType.Builder<U> |
ignoreMethods(ElementMatcher<? super MethodDescription> ignoredMethods)
Defines a matcher for methods that will be ignored for any interception attempt.
|
DynamicType.Builder.OptionalMatchedMethodInterception<U> |
implement(Class<?>... interfaceType)
Adds an interface to be implemented the created type.
|
DynamicType.Builder.OptionalMatchedMethodInterception<U> |
implement(TypeDescription... interfaceType)
Adds an interface to be implemented the created type.
|
DynamicType.Builder.MatchedMethodInterception<U> |
invokable(ElementMatcher<? super MethodDescription> methodMatcher)
Selects a set of byte code level methods, i.e.
|
DynamicType.Builder.MatchedMethodInterception<U> |
invokable(LatentMethodMatcher methodMatcher)
Selects a set of byte code level methods, i.e.
|
DynamicType.Unloaded<U> |
make()
Creates the dynamic type without loading it.
|
protected abstract DynamicType.Builder<U> |
materialize()
Materializes the current state of the build before applying another modification.
|
DynamicType.Builder.MatchedMethodInterception<U> |
method(ElementMatcher<? super MethodDescription> methodMatcher)
Selects a set of methods of this type for instrumentation.
|
DynamicType.Builder<U> |
methodLookupEngine(MethodLookupEngine.Factory methodLookupEngineFactory)
Defines the use of a specific factory for a
MethodLookupEngine . |
DynamicType.Builder<U> |
modifiers(int modifiers)
Defines modifiers for the created dynamic type.
|
DynamicType.Builder<U> |
modifiers(ModifierContributor.ForType... modifier)
Defines modifiers for the created dynamic type.
|
DynamicType.Builder<U> |
name(AuxiliaryType.NamingStrategy namingStrategy)
Defines a naming strategy for naming auxiliary types.
|
DynamicType.Builder<U> |
name(NamingStrategy namingStrategy)
Names the currently created dynamic type by the given naming strategy.
|
DynamicType.Builder<U> |
name(String name)
Names the currently created dynamic type by a fixed name.
|
public DynamicType.Builder<U> classFileVersion(ClassFileVersion classFileVersion)
DynamicType.Builder
classFileVersion
in interface DynamicType.Builder<U>
classFileVersion
- The class format version for the dynamic type to implement.public DynamicType.Builder.OptionalMatchedMethodInterception<U> implement(Class<?>... interfaceType)
DynamicType.Builder
implement
in interface DynamicType.Builder<U>
interfaceType
- The interface to implement.public DynamicType.Builder.OptionalMatchedMethodInterception<U> implement(TypeDescription... interfaceType)
DynamicType.Builder
implement
in interface DynamicType.Builder<U>
interfaceType
- A description of the interface to implement.public DynamicType.Builder<U> name(String name)
DynamicType.Builder
name
in interface DynamicType.Builder<U>
name
- A fully qualified name to give to the created dynamic type.public DynamicType.Builder<U> name(NamingStrategy namingStrategy)
DynamicType.Builder
name
in interface DynamicType.Builder<U>
namingStrategy
- The naming strategy to apply.public DynamicType.Builder<U> name(AuxiliaryType.NamingStrategy namingStrategy)
DynamicType.Builder
name
in interface DynamicType.Builder<U>
namingStrategy
- The naming strategy to use.public DynamicType.Builder<U> modifiers(ModifierContributor.ForType... modifier)
DynamicType.Builder
modifiers
in interface DynamicType.Builder<U>
modifier
- A collection of modifiers to be reflected by the created dynamic type.public DynamicType.Builder<U> modifiers(int modifiers)
DynamicType.Builder
modifiers
in interface DynamicType.Builder<U>
modifiers
- The modifiers to be reflected by the created dynamic type.public DynamicType.Builder<U> ignoreMethods(ElementMatcher<? super MethodDescription> ignoredMethods)
DynamicType.Builder
ignoreMethods
in interface DynamicType.Builder<U>
ignoredMethods
- A method matcher characterizing the methods to be ignored.public DynamicType.Builder<U> attribute(TypeAttributeAppender attributeAppender)
DynamicType.Builder
attribute
in interface DynamicType.Builder<U>
attributeAppender
- An attribute appender to be applied onto the currently created type.public DynamicType.Builder<U> annotateType(Annotation... annotation)
DynamicType.Builder
Note: The annotations will not be visible to
Implementation
s.annotateType
in interface DynamicType.Builder<U>
annotation
- The annotations to be added to the currently constructed type.public DynamicType.Builder<U> annotateType(AnnotationDescription... annotation)
DynamicType.Builder
Note: The annotations will not be visible to
Implementation
s.annotateType
in interface DynamicType.Builder<U>
annotation
- The annotations to be added to the currently constructed type.public DynamicType.Builder<U> classVisitor(ClassVisitorWrapper classVisitorWrapper)
DynamicType.Builder
ClassVisitor
to this builder which will be applied in
the construction process of this dynamic type.classVisitor
in interface DynamicType.Builder<U>
classVisitorWrapper
- The wrapper delegate for the ASM class visitor.public DynamicType.Builder<U> methodLookupEngine(MethodLookupEngine.Factory methodLookupEngineFactory)
DynamicType.Builder
MethodLookupEngine
.methodLookupEngine
in interface DynamicType.Builder<U>
methodLookupEngineFactory
- The factory to be used.public DynamicType.Builder<U> bridgeMethodResolverFactory(BridgeMethodResolver.Factory bridgeMethodResolverFactory)
DynamicType.Builder
bridgeMethodResolverFactory
in interface DynamicType.Builder<U>
bridgeMethodResolverFactory
- The bridge method resolver factory that is to be used.public DynamicType.Builder.FieldValueTarget<U> defineField(String name, Class<?> fieldType, ModifierContributor.ForField... modifier)
DynamicType.Builder
defineField
in interface DynamicType.Builder<U>
name
- The name of the method.fieldType
- The type of this field where the current type can be represented by
TargetType
.modifier
- The modifiers for this method.public DynamicType.Builder.FieldValueTarget<U> defineField(String name, TypeDescription fieldTypeDescription, ModifierContributor.ForField... modifier)
DynamicType.Builder
defineField
in interface DynamicType.Builder<U>
name
- The name of the method.fieldTypeDescription
- The type of this field where the current type can be represented by
TargetType
.modifier
- The modifiers for this method.public DynamicType.Builder.FieldValueTarget<U> defineField(String name, Class<?> fieldType, int modifiers)
DynamicType.Builder
defineField
in interface DynamicType.Builder<U>
name
- The name of the method.fieldType
- The type of this field where the current type can be represented by
TargetType
.modifiers
- The modifiers for this method.public DynamicType.Builder.FieldValueTarget<U> defineField(String name, TypeDescription fieldTypeDescription, int modifiers)
DynamicType.Builder
defineField
in interface DynamicType.Builder<U>
name
- The name of the method.fieldTypeDescription
- The type of this field where the current type can be represented by
TargetType
.modifiers
- The modifiers for this method.public DynamicType.Builder.FieldValueTarget<U> defineField(Field field)
DynamicType.Builder
defineField
in interface DynamicType.Builder<U>
field
- The field that the generated type should imitate.public DynamicType.Builder.FieldValueTarget<U> defineField(FieldDescription fieldDescription)
DynamicType.Builder
defineField
in interface DynamicType.Builder<U>
fieldDescription
- The field that the generated type should imitate.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineMethod(String name, Class<?> returnType, List<Class<?>> parameterTypes, ModifierContributor.ForMethod... modifier)
DynamicType.Builder
Note that a method definition overrides any method of identical signature that was defined in a super type what is only valid if the method is of at least broader visibility and if the overridden method is not
final
.defineMethod
in interface DynamicType.Builder<U>
name
- The name of the method.returnType
- The return type of the method where the current type can be represented by
TargetType
.parameterTypes
- The parameter types of this method where the current type can be represented by
TargetType
.modifier
- The modifiers for this method.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineMethod(String name, TypeDescription returnType, List<? extends TypeDescription> parameterTypes, ModifierContributor.ForMethod... modifier)
DynamicType.Builder
Note that a method definition overrides any method of identical signature that was defined in a super type what is only valid if the method is of at least broader visibility and if the overridden method is not
final
.defineMethod
in interface DynamicType.Builder<U>
name
- The name of the method.returnType
- A description of the return type of the method where the current type can be
represented by TargetType
.parameterTypes
- Descriptions of the parameter types of this method where the current type can be
represented by TargetType
.modifier
- The modifiers for this method.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineMethod(String name, Class<?> returnType, List<Class<?>> parameterTypes, int modifiers)
DynamicType.Builder
Note that a method definition overrides any method of identical signature that was defined in a super type what is only valid if the method is of at least broader visibility and if the overridden method is not
final
.defineMethod
in interface DynamicType.Builder<U>
name
- The name of the method.returnType
- The return type of the method where the current type can be represented by
TargetType
.parameterTypes
- The parameter types of this method where the current type can be represented by
TargetType
.modifiers
- The modifiers for this method.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineMethod(String name, TypeDescription returnType, List<? extends TypeDescription> parameterTypes, int modifiers)
DynamicType.Builder
Note that a method definition overrides any method of identical signature that was defined in a super type what is only valid if the method is of at least broader visibility and if the overridden method is not
final
.defineMethod
in interface DynamicType.Builder<U>
name
- The name of the method.returnType
- A description of the return type of the method where the current type can be
represented by TargetType
.parameterTypes
- Descriptions of the parameter types of this method where the current type can be
represented by TargetType
.modifiers
- The modifiers for this method.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineMethod(Method method)
DynamicType.Builder
Note that a method definition overrides any method of identical signature that was defined in a super type what is only valid if the method is of at least broader visibility and if the overridden method is not
final
.defineMethod
in interface DynamicType.Builder<U>
method
- The method that the generated type should imitate.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineMethod(MethodDescription methodDescription)
DynamicType.Builder
Note that a method definition overrides any method of identical signature that was defined in a super type what is only valid if the method is of at least broader visibility and if the overridden method is not
final
.defineMethod
in interface DynamicType.Builder<U>
methodDescription
- The method that the generated type should imitate.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineConstructor(Iterable<Class<?>> parameterTypes, ModifierContributor.ForMethod... modifier)
DynamicType.Builder
static
. Instead, a static type
initializer is added automatically if such an initializer is required. See
ElementMatchers.isTypeInitializer()
for a matcher for this initializer
which can be intercepted using
DynamicType.Builder.invokable(net.bytebuddy.matcher.ElementMatcher)
.
Note that a constructor's implementation must call another constructor of the same class or a constructor of its super class. This constructor call must be hardcoded inside of the constructor's method body. Before this constructor call is made, it is not legal to call any methods or to read any fields of the instance under construction.
defineConstructor
in interface DynamicType.Builder<U>
parameterTypes
- The parameter types of this constructor where the current type can be represented by
TargetType
.modifier
- The modifiers for this constructor.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineConstructor(List<? extends TypeDescription> parameterTypes, ModifierContributor.ForMethod... modifier)
DynamicType.Builder
static
. Instead, a static type
initializer is added automatically if such an initializer is required. See
ElementMatchers.isTypeInitializer()
for a matcher for this initializer
which can be intercepted using
DynamicType.Builder.invokable(net.bytebuddy.matcher.ElementMatcher)
.
Note that a constructor's implementation must call another constructor of the same class or a constructor of its super class. This constructor call must be hardcoded inside of the constructor's method body. Before this constructor call is made, it is not legal to call any methods or to read any fields of the instance under construction.
defineConstructor
in interface DynamicType.Builder<U>
parameterTypes
- The parameter types of this constructor where the current type can be represented by
TargetType
.modifier
- The modifiers for this constructor.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineConstructor(Iterable<Class<?>> parameterTypes, int modifiers)
DynamicType.Builder
static
. Instead, a static type
initializer is added automatically if such an initializer is required. See
ElementMatchers.isTypeInitializer()
for a matcher for this initializer
which can be intercepted using
DynamicType.Builder.invokable(net.bytebuddy.matcher.ElementMatcher)
.
Note that a constructor's implementation must call another constructor of the same class or a constructor of its super class. This constructor call must be hardcoded inside of the constructor's method body. Before this constructor call is made, it is not legal to call any methods or to read any fields of the instance under construction.
defineConstructor
in interface DynamicType.Builder<U>
parameterTypes
- The parameter types of this constructor where the current type can be represented by
TargetType
.modifiers
- The modifiers for this constructor.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineConstructor(List<? extends TypeDescription> parameterTypes, int modifiers)
DynamicType.Builder
static
. Instead, a static type
initializer is added automatically if such an initializer is required. See
ElementMatchers.isTypeInitializer()
for a matcher for this initializer
which can be intercepted using
DynamicType.Builder.invokable(net.bytebuddy.matcher.ElementMatcher)
.
Note that a constructor's implementation must call another constructor of the same class or a constructor of its super class. This constructor call must be hardcoded inside of the constructor's method body. Before this constructor call is made, it is not legal to call any methods or to read any fields of the instance under construction.
defineConstructor
in interface DynamicType.Builder<U>
parameterTypes
- The parameter types of this constructor where the current type can be represented by
TargetType
.modifiers
- The modifiers for this constructor.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineConstructor(Constructor<?> constructor)
DynamicType.Builder
static
. Instead, a static type
initializer is added automatically if such an initializer is required. See
ElementMatchers.isTypeInitializer()
for a matcher for this initializer
which can be intercepted using
DynamicType.Builder.invokable(net.bytebuddy.matcher.ElementMatcher)
.
Declared exceptions or annotations of the method are not copied and must be added manually.
Note that a constructor's implementation must call another constructor of the same class or a constructor of its super class. This constructor call must be hardcoded inside of the constructor's method body. Before this constructor call is made, it is not legal to call any methods or to read any fields of the instance under construction.
defineConstructor
in interface DynamicType.Builder<U>
constructor
- The constructor for the generated type to imitate.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> defineConstructor(MethodDescription methodDescription)
DynamicType.Builder
static
. Instead, a static type
initializer is added automatically if such an initializer is required. See
ElementMatchers.isTypeInitializer()
for a matcher for this initializer
which can be intercepted using
DynamicType.Builder.invokable(net.bytebuddy.matcher.ElementMatcher)
.
Declared exceptions or annotations of the method are not copied and must be added manually.
Note that a constructor's implementation must call another constructor of the same class or a constructor of its super class. This constructor call must be hardcoded inside of the constructor's method body. Before this constructor call is made, it is not legal to call any methods or to read any fields of the instance under construction.
defineConstructor
in interface DynamicType.Builder<U>
methodDescription
- The constructor for the generated type to imitate.public DynamicType.Builder.ExceptionDeclarableMethodInterception<U> define(MethodDescription methodDescription)
DynamicType.Builder
Note that a method definition overrides any method of identical signature that was defined in a super type what is only valid if the method is of at least broader visibility and if the overridden method is not
final
.define
in interface DynamicType.Builder<U>
methodDescription
- The method tor constructor hat the generated type should imitate.public DynamicType.Builder.MatchedMethodInterception<U> method(ElementMatcher<? super MethodDescription> methodMatcher)
DynamicType.Builder
method
in interface DynamicType.Builder<U>
methodMatcher
- A matcher describing the methods to be intercepted by this instrumentation.public DynamicType.Builder.MatchedMethodInterception<U> constructor(ElementMatcher<? super MethodDescription> methodMatcher)
DynamicType.Builder
constructor
in interface DynamicType.Builder<U>
methodMatcher
- A matcher describing the constructors to be intercepted by this implementation.public DynamicType.Builder.MatchedMethodInterception<U> invokable(ElementMatcher<? super MethodDescription> methodMatcher)
DynamicType.Builder
invokable
in interface DynamicType.Builder<U>
methodMatcher
- A matcher describing the byte code methods to be intercepted by this implementation.public DynamicType.Builder.MatchedMethodInterception<U> invokable(LatentMethodMatcher methodMatcher)
DynamicType.Builder
invokable
in interface DynamicType.Builder<U>
methodMatcher
- A latent matcher describing the byte code methods to be intercepted by this implementation.public DynamicType.Unloaded<U> make()
DynamicType.Builder
make
in interface DynamicType.Builder<U>
protected abstract DynamicType.Builder<U> materialize()
Copyright © 2014–2015. All rights reserved.