Annotation Interface Argument


@Documented @Retention(RUNTIME) @Target(PARAMETER) public @interface Argument

Parameters that are annotated with this annotation will be assigned the value of the parameter of the source method with the given parameter. For example, if source method foo(String, Integer) is bound to target method bar(@Argument(1) Integer), the second parameter of foo will be bound to the first argument of bar.

If a source method has less parameters than specified by value(), the method carrying this parameter annotation is excluded from the list of possible binding candidates to this particular source method. The same happens, if the source method parameter at the specified index is not assignable to the annotated parameter.

Important: Don't confuse this annotation with Advice.Argument or MemberSubstitution.Argument. This annotation should be used with MethodDelegation only.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    A binder for handling the Argument annotation.
    static enum 
    Determines if a parameter binding should be considered for resolving ambiguous method bindings.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
    The index of the parameter of the source method that should be bound to this parameter.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Determines if the argument binding is to be considered by a ArgumentTypeResolver for resolving ambiguous bindings of two methods.
  • Element Details

    • value

      int value
      The index of the parameter of the source method that should be bound to this parameter.
      Returns:
      The required parameter index.
    • bindingMechanic

      Argument.BindingMechanic bindingMechanic
      Determines if the argument binding is to be considered by a ArgumentTypeResolver for resolving ambiguous bindings of two methods. If Argument.BindingMechanic.UNIQUE, of two bindable target methods such as for example foo(String) and bar(Object), the foo method would be considered as dominant over the bar method because of its more specific argument type. As a side effect, only one parameter of any target method can be bound to a source method parameter with a given index unless the Argument.BindingMechanic.ANONYMOUS option is used for any other binding.
      Returns:
      The binding type that should be applied to this parameter binding.
      See Also:
      Default:
      UNIQUE