The origin annotation provides some meta information about the source method that is bound to this method where the binding is dependant of the parameter's type:
java.lang.reflect.Method , java.lang.reflect.Constructor or
java.lang.reflect.Executable, the parameter is assigned a reference to the method or constructor it
instruments. If the reference is not assignable to the sort of the intercepted source, the target is not considered
for binding.java.lang.Class , the parameter is assigned a reference of the
type of the instrumented type.java.lang.String , the parameter is assigned a string with
the value that would be returned by the Method#toString() method.
int type, it is assigned the intercepted method's modifiers.java.lang.invoke.MethodHandle, a handle of the intercepted method is injected.
A java.lang.invoke.MethodHandle is stored in a class's constant pool and does therefore not face the same
runtime performance limitations as a (non-cached) java.lang.reflect.Method reference. Method handles are
only supported for byte code versions starting from Java 7.java.lang.invoke.MethodType, a description of the intercepted method's type
is injected. Method type descriptions are only supported for byte code versions starting from Java 7.java.lang.invoke.MethodHandles$Lookup, a method handle lookup of the instrumented
class is returned. Method type descriptions are only supported for byte code versions starting from Java 7.
Any other parameter type will cause an java..
Important Note
A method handle or method type reference can only be used if the referenced method's types are all visible
to the instrumented type or an IllegalAccessError will be thrown at runtime.
Important Note
Don't confuse this annotation with org. or
org.. This annotation should be used with
org. only.
net.bytebuddy.implementation.MethodDelegation , net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder
| Modifier and Type | Class and Description |
|---|---|
| public static enum | Origin.
A binder for binding parameters that are annotated with |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the value for this parameter should be cached in a static field inside the instrumented class.Determines if the value that is assigned by this annotation is cached. |
| public boolean | Returns: true if the class should be looked up using an java.security.AccessController.Determines if the method should be resolved by using an |
| cache | back to summary |
|---|---|
| public boolean cache() Determines if the value that is assigned by this annotation is cached. For values that can be stored in the constant pool,
this value is ignored as such values are cached implicitly. As a result, this value currently only affects caching of
| |
| privileged | back to summary |
|---|---|
| public boolean privileged() Determines if the method should be resolved by using an
| |
org.easymock.bytebuddy.implementation.bind.annotation.Origin .
TargetMethodAnnotationDrivenBinder
| Modifier and Type | Field and Description |
|---|---|
| private static final MethodDescription. | CACHE
A description of the |
| public static final Origin. | INSTANCE
The singleton instance. |
| private static final MethodDescription. | PRIVILEGED
A description of the |
| 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.
|
| private static StackManipulation | Returns: An appropriate stack manipulation.The origin annotation. annotation,The method description to load. methodDescriptionLoads a method constant onto the operand stack. |
| public static Origin. | |
| public static Origin. |
| CACHE | back to summary |
|---|---|
| private static final MethodDescription. A description of the | |
| INSTANCE | back to summary |
|---|---|
| public static final Origin. The singleton instance. | |
| PRIVILEGED | back to summary |
|---|---|
| private static final MethodDescription. A description of the | |
| 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.
| |
| methodConstant | back to summary |
|---|---|
| private static StackManipulation methodConstant(AnnotationDescription. Loads a method constant onto the operand stack.
| |
| valueOf | back to summary |
|---|---|
| public static Origin. | |
| values | back to summary |
|---|---|
| public static Origin. | |