Currently, no. The diff
variable is a local variable and is therefore only accessible within the body of the method, after it's been declared (and initialized).
AOP advice is meant to add additional behavior (by executing code) at a certain point in the execution of a program. It's a self contained component. It can know about the code it's intercepting, but not vice-versa.
There are obviously work arounds if you need to do this, but I don't recommend it. You can use a static
ThreadLocal
in some class and set its value to whatever diff
is. You can then access that ThreadLocal
anywhere else.