i want to define a pointcut which matches all public methods of a certain packacke with at least one certain run-time parameter passed as argument to such a method. Example:
execution (public * my.simple.packacke..*(..)) and (args(authorizable))
This works for all methods that have exactly one parameter of type "my.simple.interfaces.Authorizable". But of course later on a developer could introduce a new method into the above package with a signature like this
my.simple.packacke.MyClass#foo(int i, Authorizable authorizable). Now the aspect handling the authorization mechanism would not be called.
So i need a way to define all methods in a desired package with at least one (or more) parameters passed which are of type X. Something like (args(*, authorizable, *)). But this and other combinations doesn't seem to work. I tried:
- args(*, authorizable, *) - no error but also no match *grr*
- args(authorizable, ..) - matches only if the first param is of type Authorizable
- args(authorizable) or args(*, authorizable) or (authorizable, *) - matches only if the first or last param is of type Authorizable or there is only one param of type Authorizable.
Of course i could implement the aspect in a way that it determines if a param is of type Authorizable via the JoinPoints#getArgs() method. This already works, but i would be a bit more satisfied if i could constrain the pointcut expression.
TIA for any ideas,