Hello, Hum, ok, but if you don't have the Aspect1 source-code, that is a little bit difficult to implement ... Let's suppose you just have the aspect and its specification, where you can find out everything you need... :-) So you decide to intercept its joinpoints as you have showed us. Is there any way to do this as you can do it with a class when you dont have the source? I meant, if the class documentation tell me that it has a "withdraw" method, it's easy to write an aspect to intercept it, right?
thanks a lot > From: "Davi Pires" <[EMAIL PROTECTED]> > Subject: Re: [aspectj-users] how to intercept joinpoints ... > To: [email protected] > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="iso-8859-1" > > Not very neat... > > If you need a way to "name" your advices, I suggest using > annotations. For example: > > public aspect Aspect1 { > pointcut pc(): execution(* Foo.m1(..)); > > @BeforeAdvice > before(): pc() { > System.out.println("I'm before m1"); > } > > @AfterAdvice > after(): pc() { > System.out.println("I'm after m1"); > } > > } > > public aspect Aspect2 { > > pointcut beforeM1(): within(Aspect1) && @annotation(BeforeAdvice) > ; pointcut afterM1(): within(Aspect1) && @annotation(AfterAdvice); > > before(): beforeM1() { > System.out.println("I'm before before m1."); > } > > after(): beforeM1() { > System.out.println("I'm after before m1."); > } > > before(): afterM1() { > System.out.println("I'm before after m1."); > } > > after(): afterM1() { > System.out.println("I'm after after m1."); > } > > } > > This works as expected, and generates a correct output. > > Davi > _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
