[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] change pointcut expression before weaving

You could define an abstract aspect with an abstract pointcut that is
attached to all your existing pointcuts:

abstract aspect Foo {

  abstract pointcut fillInLater();

  before(): something() && fillInLater() {

And then create the aop.xml as late as possible, just before the
weaver is invoked ( that defines the concrete sub-aspect, and the
definition of fillInLater()) - i think some people have done this in
the past.  I also think there is a way to supply your own
IWeavingContext that skips the need to write out aop.xml and have the
weaver read it in again by making an implementation that returns the
elements that would have been in the xml.

Or given that if() is used to call static code, can you not build in a
call to something like if(MyClass.testMethod()) into all your existing
pointcuts and then make that testMethod() do whatever conditional test
you want to perform to influence the matching?

There is currently no general way to change the pointcuts post compile
and before weaving.


2008/7/21 G <gsoel@xxxxxxx>:
> Hi,
> i am trying to modify an already compiled aspect before doing ltw.
> I want to modify all the pointcuts within the aspect and add an
> if-evaluation.
> Is this possible with aspectj?
> Kind regards,
> Marc
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users