null
. This class interprets arguments in the following way:
thisJoinPoint
to the advice, and the parameter name will be assigned the value "thisJoinPoint"
.JoinPoint.StaticPart
, it is assumed to be for passing "thisJoinPointStaticPart"
to the advice, and the parameter name will be assigned the value "thisJoinPointStaticPart"
.Throwable+
, then an {@link IllegalArgumentException} is raised. If there is more than oneunbound argument of type Throwable+
, then an {@link AmbiguousBindingException} is raised. If there is exactly oneunbound argument of type Throwable+
, then the corresponding parameter name is assigned the value <throwingName>.a
be the number of annotation-based pointcut expressions (@annotation, @this, @target, @args, @within, @withincode) that are used in binding form. Usage in binding form has itself to be deduced: if the expression inside the pointcut is a single string literal that meets Java variable name conventions it is assumed to be a variable name. If a
is zero we proceed to the next stage. If a
> 1 then an AmbiguousBindingException
is raised. If a
== 1, and there are no unbound arguments of type Annotation+
, then an IllegalArgumentException
is raised. if there is exactly one such argument, then the corresponding parameter name is assigned the value from the pointcut expression.IllegalArgumentException
is raised. If there is more than one unbound argument then an AmbiguousBindingException
is raised. If there is exactly one unbound argument then the corresponding parameter name is assigned the value <returningName>.this
, target
, and args
pointcut expressions used in the binding form (binding forms are deduced as described for the annotation based pointcuts). If there remains more than one unbound argument of a primitive type (which can only be bound in args
) then an AmbiguousBindingException
is raised. If there is exactly one argument of a primitive type, then if exactly one args
bound variable was found, we assign the corresponding parameter name the variable name. If there were no args
bound variables found an IllegalStateException
is raised. If there are multiple args
bound variables, an AmbiguousBindingException
is raised. At this point, if there remains more than one unbound argument we raise an AmbiguousBindingException
. If there are no unbound arguments remaining, we are done. If there is exactly one unbound argument remaining, and only one candidate variable name unbound from this
, target
, or args
, it is assigned as the corresponding parameter name. If there are multiple possibilities, an AmbiguousBindingException
is raised.The behavior on raising an IllegalArgumentException
or AmbiguousBindingException
is configurable to allow this discoverer to be used as part of a chain-of-responsibility. By default the condition will be logged and the getParameterNames(..)
method will simply return null
. If the {@link #setRaiseExceptions(boolean) raiseExceptions}property is set to true
, the conditions will be thrown as IllegalArgumentException
and AmbiguousBindingException
, respectively.
Was that perfectly clear? ;)
Short version: If an unambiguous binding can be deduced, then it is. If the advice requirements cannot possibly be satisfied, then null
is returned. By setting the {@link #setRaiseExceptions(boolean) raiseExceptions}property to true
, descriptive exceptions will be thrown instead of returning null
in the case that the parameter names cannot be discovered.
@author Adrian Colyer
@since 2.0
|
|
|
|