super methods of the instrumented type where the parameter type must be a super type of the instrumented type.
The proxy type will be a direct subclass of the parameter's type such as for example a specific interface.
Obviously, the proxy type must be instantiated before it is assigned to the intercepting method's parameter. For this purpose, two strategies are available which can be specified by setting the
Super#strategy() parameter which can
be assigned:
org.easymock.bytebuddy.implementation.bind.annotation.Super.Instantiation#CONSTRUCTOR :
A constructor call is made where Super#constructorParameters() determines the constructor's signature. Any constructor
parameter is assigned the parameter's default value when the constructor is called. Calling the default constructor is the
preconfigured strategy.org.easymock.bytebuddy.implementation.bind.annotation.Super.Instantiation#UNSAFE :
The proxy is created by making use of Java's sun.reflect.ReflectionFactory which is however not a public API which
is why it should be used with care. No constructor is called when this strategy is used. If this option is set, the
Super#constructorParameters() parameter is ignored.Foo that implements some interface Bar, the proxy type
will only implement Bar and therefore extend java.lang.Object what allows for calling the default
constructor on the proxy. This implies that an interception by some method qux(@Super Baz baz, @Super Bar bar)
would cause the creation of two super call proxies, one extending Baz, the other extending Bar, give
that both types are super types of Foo.
As an exception, no method calls to
Object#finalize() are delegated by calling this method on the super-call
proxy by default. If this is absolutely necessary, this can however be enabled by setting Super#ignoreFinalizer()
to false.
If a method parameter is not a super type of the instrumented type, the method with the parameter that is annotated by #
Super is not considered a possible delegation target.
net.bytebuddy.implementation.MethodDelegation , net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder
| Modifier and Type | Class and Description |
|---|---|
| public static enum | Super.
A binder for handling the
|
| public static enum | Super.
Determines the instantiation of the proxy type. |
| Modifier and Type | Method and Description |
|---|---|
| public Class | Returns: The parameter types of the constructor to be called.Defines the parameter types of the constructor to be called for the created |
| public boolean | Returns: false if finalizer methods should be considered for super-call proxy type delegation.If |
| public Class | |
| public boolean | |
| public Super. | Returns: The instantiation strategy for this proxy.Determines how the |
| constructorParameters | back to summary |
|---|---|
| public Class Defines the parameter types of the constructor to be called for the created
| |
| ignoreFinalizer | back to summary |
|---|---|
| public boolean ignoreFinalizer() If
| |
| proxyType | back to summary |
|---|---|
| public Class Determines the type that is implemented by the proxy. When this value is set to its default value
| |
| serializableProxy | back to summary |
|---|---|
| public boolean serializableProxy() Determines if the generated proxy should be
| |
| strategy | back to summary |
|---|---|
| public Super. Determines how the
| |
org.easymock.bytebuddy.implementation.bind.annotation.Super
annotation.
TargetMethodAnnotationDrivenBinder
| Modifier and Type | Class and Description |
|---|---|
| protected static interface | Super.
Locates the type which should be the base type of the created proxy. |
| Modifier and Type | Field and Description |
|---|---|
| public static final Super. | INSTANCE
The singleton instance. |
| private static final MethodDescription. | PROXY_TYPE
A reference to the proxy type property. |
| private static final MethodDescription. | STRATEGY
A method reference to the strategy property. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public MethodDelegationBinder. | bind(AnnotationDescription.
The annotation that was cause for the delegation to this argument binder. annotation,The intercepted source method. source, ParameterDescription Tge target parameter that is subject to be bound to
intercepting the target, Implementation.source method.The target of the current implementation that is subject to this binding. implementationTarget,An assigner that can be used for applying the binding. assigner, Assigner.The typing to apply. typing |
| public Class | getHandledType()
The annotation type that is handled by this parameter binder.
|
| public static Super. | |
| public static Super. |
| INSTANCE | back to summary |
|---|---|
| public static final Super. The singleton instance. | |
| PROXY_TYPE | back to summary |
|---|---|
| private static final MethodDescription. A reference to the proxy type property. | |
| STRATEGY | back to summary |
|---|---|
| private static final MethodDescription. A method reference to the strategy property. | |
| Binder | back to summary |
|---|---|
| private Binder() | |
| bind | back to summary |
|---|---|
| public MethodDelegationBinder. Creates a parameter binding for the given target parameter.
| |
| getHandledType | back to summary |
|---|---|
| public Class The annotation type that is handled by this parameter binder.
| |
| valueOf | back to summary |
|---|---|
| public static Super. | |
| values | back to summary |
|---|---|
| public static Super. | |
| Modifier and Type | Class and Description |
|---|---|
| public static enum | Super.
A type locator that yields the instrumented type. |
| public static enum | Super.
A type locator that yields the target parameter's type. |
| public static class | Super.
A type locator that returns a given type. |
| Modifier and Type | Method and Description |
|---|---|
| public TypeDescription | Returns: The proxy type.The instrumented type. instrumentedType, TypeDescription.The type of the target parameter. parameterTypeResolves the target type. |
| resolve | back to summary |
|---|---|
| public TypeDescription resolve(TypeDescription instrumentedType, TypeDescription. Resolves the target type.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final Super. | INSTANCE
The singleton instance. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public TypeDescription | resolve(TypeDescription
The instrumented type. instrumentedType, TypeDescription.The type of the target parameter. parameterTypeImplements org. |
| public static Super. | |
| public static Super. |
| INSTANCE | back to summary |
|---|---|
| public static final Super. The singleton instance. | |
| ForInstrumentedType | back to summary |
|---|---|
| private ForInstrumentedType() | |
| resolve | back to summary |
|---|---|
| public TypeDescription resolve(TypeDescription instrumentedType, TypeDescription. Implements org. Doc from org. Resolves the target type.
| |
| valueOf | back to summary |
|---|---|
| public static Super. | |
| values | back to summary |
|---|---|
| public static Super. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Super. | INSTANCE
The singleton instance. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public TypeDescription | resolve(TypeDescription
The instrumented type. instrumentedType, TypeDescription.The type of the target parameter. parameterTypeImplements org. |
| public static Super. | |
| public static Super. |
| INSTANCE | back to summary |
|---|---|
| public static final Super. The singleton instance. | |
| ForParameterType | back to summary |
|---|---|
| private ForParameterType() | |
| resolve | back to summary |
|---|---|
| public TypeDescription resolve(TypeDescription instrumentedType, TypeDescription. Implements org. Doc from org. Resolves the target type.
| |
| valueOf | back to summary |
|---|---|
| public static Super. | |
| values | back to summary |
|---|---|
| public static Super. | |
| Modifier and Type | Field and Description |
|---|---|
| private final TypeDescription | typeDescription
The type to be returned upon resolution. |
| Access | Constructor and Description |
|---|---|
| protected | ForType(TypeDescription
The type to be returned upon resolution. typeDescription)Creates a new type locator for a given type. |
| Modifier and Type | Method and Description |
|---|---|
| protected static Super. | Returns: The appropriate type locator.The annotation's value. typeDescription)Resolves a type locator based upon an annotation value. |
| public TypeDescription | resolve(TypeDescription
The instrumented type. instrumentedType, TypeDescription.The type of the target parameter. parameterTypeImplements org. |
| typeDescription | back to summary |
|---|---|
| private final TypeDescription typeDescription The type to be returned upon resolution. | |
| ForType | back to summary |
|---|---|
| protected ForType(TypeDescription typeDescription) Creates a new type locator for a given type.
| |
| of | back to summary |
|---|---|
| protected static Super. Resolves a type locator based upon an annotation value.
| |
| resolve | back to summary |
|---|---|
| public TypeDescription resolve(TypeDescription instrumentedType, TypeDescription. Implements org. Doc from org. Resolves the target type.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final Super. | CONSTRUCTOR
A proxy instance is instantiated by its constructor. |
| private static final MethodDescription. | CONSTRUCTOR_PARAMETERS
A reference to the constructor parameters method. |
| private static final MethodDescription. | IGNORE_FINALIZER
A reference to the ignore finalizer method. |
| private static final MethodDescription. | SERIALIZABLE_PROXY
A reference to the serializable proxy method. |
| public static final Super. | UNSAFE
A proxy is instantiated by calling JVM internal methods and without calling a constructor. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract StackManipulation | Returns: A stack manipulation representing this instance's instantiation strategy.The type of the parameter that was annotated with
parameterType, Implementation.org.The implementation target for the currently created type. implementationTarget,The annotation that caused this method call. annotationCreates a stack manipulation which loads a |
| public static Super. | |
| public static Super. |
| CONSTRUCTOR | back to summary |
|---|---|
| public static final Super. A proxy instance is instantiated by its constructor. For the constructor's arguments, the parameters default
values are used. The constructor can be identified by setting | |
| CONSTRUCTOR_PARAMETERS | back to summary |
|---|---|
| private static final MethodDescription. A reference to the constructor parameters method. | |
| IGNORE_FINALIZER | back to summary |
|---|---|
| private static final MethodDescription. A reference to the ignore finalizer method. | |
| SERIALIZABLE_PROXY | back to summary |
|---|---|
| private static final MethodDescription. A reference to the serializable proxy method. | |
| UNSAFE | back to summary |
|---|---|
| public static final Super. A proxy is instantiated by calling JVM internal methods and without calling a constructor. This strategy might fail on exotic JVM implementations. | |
| Instantiation | back to summary |
|---|---|
| private Instantiation() | |
| proxyFor | back to summary |
|---|---|
| protected abstract StackManipulation proxyFor(TypeDescription parameterType, Implementation. Creates a stack manipulation which loads a
| |
| valueOf | back to summary |
|---|---|
| public static Super. | |
| values | back to summary |
|---|---|
| public static Super. | |