S
- 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.public abstract static class DynamicType.Builder.AbstractBase<S> extends Object implements DynamicType.Builder<S>
TargetType
class can be used as a placeholder.Modifier and Type | Class and Description |
---|---|
protected class |
DynamicType.Builder.AbstractBase.AbstractDelegatingBuilder<U>
A base implementation of a builder that is capable of manifesting a change that was not yet applied to
the builder.
|
protected static class |
DynamicType.Builder.AbstractBase.FieldToken
A field token representing a latent field that is defined for the built dynamic type.
|
protected static class |
DynamicType.Builder.AbstractBase.MethodToken
A method token representing a latent method that is defined for the built dynamic type.
|
DynamicType.Builder.AbstractBase<S>, DynamicType.Builder.ExceptionDeclarableMethodInterception<S>, DynamicType.Builder.FieldAnnotationTarget<S>, DynamicType.Builder.MatchedMethodInterception<T>, DynamicType.Builder.MethodAnnotationTarget<S>, DynamicType.Builder.OptionalMatchedMethodInterception<S>
Modifier and Type | Field and Description |
---|---|
protected List<DynamicType.Builder.AbstractBase.FieldToken> |
fieldTokens
This builder's currently registered field tokens.
|
protected List<DynamicType.Builder.AbstractBase.MethodToken> |
methodTokens
This builder's currently registered method tokens.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractBase(List<DynamicType.Builder.AbstractBase.FieldToken> fieldTokens,
List<DynamicType.Builder.AbstractBase.MethodToken> methodTokens)
Creates a new builder for a dynamic type.
|
Modifier and Type | Method and Description |
---|---|
protected InstrumentedType |
applyRecordedMembersTo(InstrumentedType instrumentedType)
Adds all fields and methods to an instrumented type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<S> |
defineConstructor(Iterable<Class<?>> parameterTypes,
ModifierContributor.ForMethod... modifier)
Defines a new constructor for this type.
|
DynamicType.Builder.FieldAnnotationTarget<S> |
defineField(String name,
Class<?> fieldType,
ModifierContributor.ForField... modifier)
Defines a new field for this type.
|
DynamicType.Builder.ExceptionDeclarableMethodInterception<S> |
defineMethod(String name,
Class<?> returnType,
List<Class<?>> parameterTypes,
ModifierContributor.ForMethod... modifier)
Defines a new method for this type.
|
DynamicType.Builder.OptionalMatchedMethodInterception<S> |
implement(Class<?> interfaceType)
Adds an interface to be implemented the created type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
annotateType, attribute, classFormatVersion, classVisitor, constructor, defineConstructor, defineField, defineMethod, ignoreMethods, implement, invokable, make, method, modifiers, name
protected final List<DynamicType.Builder.AbstractBase.FieldToken> fieldTokens
protected final List<DynamicType.Builder.AbstractBase.MethodToken> methodTokens
protected AbstractBase(List<DynamicType.Builder.AbstractBase.FieldToken> fieldTokens, List<DynamicType.Builder.AbstractBase.MethodToken> methodTokens)
fieldTokens
- A list of fields registered for this builder.methodTokens
- A list of methods registered for this builder.protected InstrumentedType applyRecordedMembersTo(InstrumentedType instrumentedType)
instrumentedType
- The instrumented type that is basis of the alteration.public DynamicType.Builder.OptionalMatchedMethodInterception<S> implement(Class<?> interfaceType)
DynamicType.Builder
implement
in interface DynamicType.Builder<S>
interfaceType
- The interface to implement.public DynamicType.Builder.FieldAnnotationTarget<S> defineField(String name, Class<?> fieldType, ModifierContributor.ForField... modifier)
DynamicType.Builder
defineField
in interface DynamicType.Builder<S>
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.ExceptionDeclarableMethodInterception<S> defineMethod(String name, Class<?> returnType, List<Class<?>> parameterTypes, ModifierContributor.ForMethod... modifier)
DynamicType.Builder
Note that a method definition will shadow any method of identical signature that was defined in a super class. This implies that the defined method will be treated as if it does not have a super implementation.
defineMethod
in interface DynamicType.Builder<S>
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<S> defineConstructor(Iterable<Class<?>> parameterTypes, ModifierContributor.ForMethod... modifier)
DynamicType.Builder
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<S>
parameterTypes
- The parameter types of this constructor where the current type can be represented by
TargetType
.modifier
- The modifiers for this constructor.Copyright © 2014. All rights reserved.