Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Get the join points advised by the aspect


Paulo,

The simplest approach is to use the "-showWeaveInfo" compiler option which will tell you all the woven join points. You could then use a custom message handler to format the information. There is currently no public supported meta-data or accompanying AspectJ API that allows you to enumerate woven join points.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/



Paulo Alexandre Corigo Zenida <paulo.zenida@xxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

09/11/2006 20:39

Please respond to
aspectj-users@xxxxxxxxxxx

To
AspectJ Mailing List <aspectj-users@xxxxxxxxxxx>
cc
Subject
[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


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top