[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Get the join points advised by the aspect
|
Hi all,
I was wondering if it is possible to know all join poits that a certain
aspect advices in runtime. For example, the following aspects:
public abstract aspect A {
public pointcut x() :
call(* C.foo());
@MyAnnotation
before() : x() {
System.out.println("Before");
}
}
public aspect ExtendedA extends A {
public pointcut x() : A.x() ||
call(* C.bar());
}
I would like to be able to get the methods, for this simple example,
bar() and foo() of class C. I know I can get to the advised methods,
one at a time, when the aspect is advising the join point with
something like, but that is not my goal (I need to load all join points
at the beginning of the program):
before() : adviceexecution() && @annotation(MyAnnotation) {
final JoinPoint arg0 = (JoinPoint)thisJoinPoint.getArgs()[0];
final Signature signature = arg0.getSignature();
}
I have tried to use reflection to see the definition for a certain
pointcut in an aspect. I got the before advice on aspect A and got the
pointcut expression. Something like:
(call(* C.bar()) || (x())
That would force me to get a way to parse the expression in order to
know which join points are actually matched with the pointcut
definition...
Is there anything that can help on this? I suppose the AspectJ API has
features that would support this. Am I mistaken? Any help would be
greatly appreciated.
Thanks for your interest,
Paulo Zenida