Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] A question about advice

In Java, the references of objects can be passed in parameters of a
method. However, in the advice code, if it needs to use other objects
which don't appear in the join point, how could the advice get the
reference to those objects?

Hi.

Somehow I don't see how this "problem" is specific to AspectJ or even AOP in general. In an ordinary method you have the same problem: How to retrieve a reference to an object which is not contained in the signature? Well usually, you will want to extend the signature, retrieve the reference from a field or even use a singleton. The same counts for aspects: Either tweak the pointcut signature so that it exposes the object you need, or collect the object at some different point and store it in a field, or even use a singleton...

Eric


Back to the top