@Documented @Retention(value=RUNTIME) @Target(value=PARAMETER) public @interface Origin
Method, the parameter is assigned a reference
to the method it intercepts.Class, the parameter is assigned a reference of the
type of the instrumented type.String, the parameter is assigned a string describing
a unique method signature of the method it intercepts. This string is a concatenation of:
Method instance.
MethodHandle, a handle of the intercepted method is injected.
A MethodHandle is stored in a class's constant pool and does therefore not face the same
runtime performance limitations as a Method reference. Method handles are only supported
for byte code versions starting from Java 7.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.IllegalStateException.| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
cacheMethod
If this value is set to
true and the annotated parameter is a Method type,
the value that is assigned to this parameter is cached in a static field. |
public abstract boolean cacheMethod
true and the annotated parameter is a Method type,
the value that is assigned to this parameter is cached in a static field. Otherwise, the instance is
looked up from its defining Class on every invocation of the intercepted method.
Method look-ups are normally cached by its defining Class what
makes a repeated look-up of a method little expensive. However, because Method
instances are mutable by their AccessibleObject contact, any looked-up instance
needs to be copied by its defining Class before exposing it. This can cause performance
deficits when a method is for example called repeatedly in a loop. By enabling the method cache, this
performance penalty can be avoided by caching a single Method instance for
any intercepted method as a static field in the instrumented type.true if the annotated Method parameter should be assigned a cached
instance. For any other parameter type, this value is ignored.Copyright © 2014. All rights reserved.