Annotation Type FieldValue
-
@Documented @Retention(RUNTIME) @Target(PARAMETER) public @interface FieldValue
Assigns the value of a field of the instrumented type to the annotated parameter. For a binding to be valid, the instrumented type must be able to access a field of the given name. Also, the parameter's type must be assignable to the given field. For attempting a type casting, the
RuntimeType
annotation can be applied to the parameter.Setting
value()
is optional. If the value is not set, the field value attempts to bind a setter's or getter's field if the intercepted method is an accessor method. Otherwise, the binding renders the target method to be an illegal candidate for binding.Important: Don't confuse this annotation with
Advice.FieldValue
annotation. This annotation should be used only in combination with method delegation (MethodDelegation.to(...)
). ForAdvice
ASM visitor use alternative annotation fromnet.bytebuddy.asm.Advice
package.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.Class<?>
declaringType
Defines the type on which the field is declared.java.lang.String
value
The name of the field to be accessed.
-
-
-
-
declaringType
java.lang.Class<?> declaringType
Defines the type on which the field is declared. If this value is not set, the most specific type's field is read, if two fields with the same name exist in the same type hierarchy.- Returns:
- The type that declares the accessed field.
- Default:
- void.class
-
-