Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] generic access to method arguments


Hi,

I have a pointcut that is picking out all methods that have a particular annotation. This works fine.

	 public pointcut withMyAnnotation(MyAnnotation myAnnotation) :
	        execution(@MyAnnotation  * *(..)) && @annotation(myAnnotation);

	    Object around(MyAnnotation myAnnotation) : withMyAnnotation(myAnnotation) {


What I don't know how to do is have access to the method arguments without restricting what the arguments are. I'd like to have a list of all the arguments (maybe empty) that were actually passed in to the advised method without knowing/limiting which methods are advised. Something like: (I know it doesn't work, but I think it expresses the sentiment).

	 public pointcut withMyAnnotation(MyAnnotation myAnnotation, Object[] arguments) :
	        execution(@MyAnnotation  * *(..)) && @annotation(myAnnotation) && args(arguments);

	    Object around(MyAnnotation myAnnotation, Object[] arguments) : withMyAnnotation(myAnnotation, arguments) {


Any help? Is this possible?

-Dan


Back to the top