Annotation Interface Advice.Argument

Enclosing class:
Advice

@Documented @Retention(RUNTIME) @Target(PARAMETER) public static @interface Advice.Argument

Indicates that the annotated parameter should be mapped to the parameter with index value() of the instrumented method.

Important: Don't confuse this annotation with Argument annotation. This annotation should be used only in combination with Advice ASM visitor. For method delegation (MethodDelegation.to(...)) use alternative annotation from net.bytebuddy.implementation.bind package.

See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
    Returns the index of the mapped parameter.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Indicates if a parameter binding is optional.
    boolean
    Indicates if it is possible to write to this parameter.
    The typing that should be applied when assigning the argument.
  • Element Details

    • value

      int value
      Returns the index of the mapped parameter.
      Returns:
      The index of the mapped parameter.
    • readOnly

      boolean readOnly

      Indicates if it is possible to write to this parameter. If this property is set to false, the annotated type must be equal to the type declaring the instrumented method if the typing is not also set to Assigner.Typing.DYNAMIC. If this property is set to true, the annotated parameter can be any super type of the instrumented method's declaring type.

      Important: This property must be set to true if the advice method is not inlined.

      Returns:
      true if this parameter is read-only.
      Default:
      true
    • typing

      The typing that should be applied when assigning the argument.
      Returns:
      The typing to apply upon assignment.
      Default:
      STATIC
    • optional

      boolean optional
      Indicates if a parameter binding is optional. If a binding is optional and a parameter with the specified index does not exist, the parameter's default value is bound.
      Returns:
      true if the binding is optional.
      Default:
      false