@Documented @Retention(value=RUNTIME) @Target(value=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.
Modifier and Type | Required Element and Description |
---|---|
int |
value
The index of the parameter of the source method that should be bound to this parameter.
|
Modifier and Type | Optional Element and Description |
---|---|
Argument.BindingMechanic |
bindingMechanic
Determines if the argument binding is to be considered by a
ArgumentTypeResolver
for resolving ambiguous bindings of two methods. |
public abstract int value
public abstract Argument.BindingMechanic bindingMechanic
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.ArgumentTypeResolver
Copyright © 2014–2024. All rights reserved.