The JoinPoint of @Around advice, which can also run the call.
An @Around advice replaces the call, so it needs a way to run the
real method (or the next advice) when it chooses to: proceed. Calling
it with new arguments changes what the method receives; not calling it
skips the method; calling it again retries. An @Around advice method
must take one.
// Keeps the second factor of `multiply` between 0 and 10.
@Around('execution(* Calculator.multiply(..))')
Object? clamp(ProceedingJoinPoint joinPoint) {
final [a, b] = joinPoint.args;
return joinPoint.proceed([a, (b! as int).clamp(0, 10)]);
}
Spring (Java):
@Around("execution(* Calculator.multiply(..))")
Object clamp(ProceedingJoinPoint joinPoint) throws Throwable {
Object[] args = joinPoint.getArgs();
args[1] = Math.min(Math.max((int) args[1], 0), 10);
return joinPoint.proceed(args);
}
- Implemented types
Properties
-
args
→ List<
Object?> -
The arguments in declaration order: positional ones, then named ones
(in the order of MethodSignature.parameterNames).
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- proxy → Object
-
The proxy the caller called, the object other beans hold. For a
generated subclass proxy it is the bean itself, like target.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signature → MethodSignature
-
The called member: its name, types and annotations.
no setterinherited
- target → Object
-
The bean whose member runs: the object behind the proxy.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
proceed(
[List< Object?> ? args]) → Object? - Runs the next advice, or the member itself after the last one, and returns its result.
-
toShortString(
) → String -
A short description for logs, such as
execution(Greeter.greet(..)).inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited