@Target(value=METHOD) @Retention(value=RUNTIME) public @interface OnReturn
Pointcut class that should be run just after each
method (or constructor) execution picked out by the Pointcut, but only if the method
picked out by the Pointcut returns successfully (does not throw an Exception).
Only one method in a @Pointcut class may be annotated with
@OnReturn.
An @OnReturn method can accept parameters annotated with any of the following:
@BindReceiver, @BindParameter,
@BindParameterArray, @BindMethodName,
@BindTraveler or @BindReturn.
@BindTraveler can only be used if there is a corresponding
@OnBefore method that returns a non-void type (the traveler).
@BindReturn can only be used if each method picked out by the Pointcut
returns a non-void type. If @BindReturn is used, it must be the first
parameter to the @OnReturn method.
An @OnReturn method may return void or a non-void type. If it
returns a non-void type, the value returned by the @OnReturn method is
returned from the method execution picked out by the Pointcut instead of that method's
original return value. This can be used to wrap the original return value by passing the original
return value in to an @OnReturn method (using
@BindReturn) and then returning the wrapped value.
Copyright © 2011–2019 Glowroot contributors. All rights reserved.