Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Aspects and Ecents

João ,
I am new to AspectJ too so I am not sure whether there is any direct method to do this.
But here is what I would try:
Use a withincode pointcut to intercept execution of field.addListener() within m1().
In the advice (advice1) collect the reference of  Listeners in a list.
Use another pointcut to intercept execution of methodToBeReached() that cflowbelow(checkBoxSelected()). In the advice, lookup the listener object in the list prepared by advice1.
If the listener is found in the list this will indicate that the listener was added from m1().

Regards
Tahir Akhtar

João Paulo Sabino de Moraes wrote:
Hello all,

I want to reach a method within an event defined by just one method (m1 in this case), but this event is instantiated over 2 different methods like:

m1() {

      field.addListener( new Listener() {
             
           checkBoxSelected(Event e) {
          
                  methodToBeReached()
            }

      });
}

m2() {

      field.addListener( new Listener() {
             
           checkBoxSelected(Event e) {
          
                  methodToBeReached()
            }

      });
}

when the event occurs, its flow isn't within m2 or m1 normal flow, so cflowbelow does not works for the methods...
Is there a way to interceptate only the methodToBeReached() instantiated at m1 method?

thanks

--
jp

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


Back to the top