Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ advising with generic pointcuts

Am 28.12.2010 19:47, schrieb Srinivas:
> I want to advise all methods which either take Vehicle type as the first
> argument, or a derived class of Vehicle as the first argument.

> Can this be done with AspectJ with just one pointcut?

Hi Srinivas,

basically yes, that is easygoing...


pointcut allVehicleUsers() : execution( * *.*(Vehicle+, ..));

> I am using the AspectJ maven plugin.
There is one catch of some sort: in order for the above to work,
you need to manage that all the classfiles with all the methods to
be adivsed are actually processed by the AspectJ weaver.

If you have a simple project and are just compiling with AspectJ,
this is trivially easy. In an enterprise project with multiple
independently built modules, achieving this can get quite involved.
It boils down to configuring the build process precisely.

Hope that helps,
Hermann V.


Back to the top