Annotation Type 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.
    See Also:
    MethodDelegation, TargetMethodAnnotationDrivenBinder, RuntimeType
    • Required Element Summary

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

      • 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:
        ArgumentTypeResolver
        Default:
        net.bytebuddy.implementation.bind.annotation.Argument.BindingMechanic.UNIQUE