Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ and memory management

Adrian Colyer wrote:
Ok, we're nearly there then. You can be more general than my pointcut
suggests - I was encoding your literal example. The following fragments
should get you there....

If I can assume:

* the interfaces you want to enable delegation for are in some set of
packages   org.xyz.interfaces..*
* the classes you want to enable delagation for are in some set of packages
org.xyz.impl..*
* and the target replacement classes are in a different package

then:

pointcut delegatedInvocation(Object obj) : execution(*
org.xyz.interfaces..*(..)) && within(org.xyz.impl..*) && this(obj);

Object around(Object obj) : delegatedInvocation(obj) {
   framework.getDispatchTargetFor(obj);
   ... as before ...
}

There are other variations if you don't have this kind of package
separation, but this is the simplest.

That might work reasonably well. I'll have to try it out.

regards,
  Rickard



Back to the top