Annotation Type Argument
-
@Documented @Retention(RUNTIME) @Target(PARAMETER) public @interface ArgumentParameters 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 methodbar(@Argument(1) Integer), the second parameter offoowill be bound to the first argument ofbar.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.ArgumentorMemberSubstitution.Argument. This annotation should be used withMethodDelegationonly.
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description intvalueThe 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 Argument.BindingMechanicbindingMechanicDetermines if the argument binding is to be considered by aArgumentTypeResolverfor resolving ambiguous bindings of two methods.
-
-
-
-
bindingMechanic
Argument.BindingMechanic bindingMechanic
Determines if the argument binding is to be considered by aArgumentTypeResolverfor resolving ambiguous bindings of two methods. IfArgument.BindingMechanic.UNIQUE, of two bindable target methods such as for examplefoo(String)andbar(Object), thefoomethod would be considered as dominant over thebarmethod 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 theArgument.BindingMechanic.ANONYMOUSoption 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
-
-