Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] how to refer to pointcut defined in other aspects which extend the same parent aspect?

Again, I don't think there is any direct way of doing this, but
something that comes to my mind is the following:

* this only works if all other advice used are around() with proceed()
* set the InterceptAspect to the lowest precendence (ie- runs last)
* then set your pointcut to capture all method executions that are
!(cflow(adviceexecution()) && within(ParentAspect+)
* Also, this will not work if you have advice being applied more than
once in your stack.

I haven't tried this, but it might work for you.

On Sun, Aug 16, 2009 at 9:47 AM, ppkluk<imperfectluk-ppk@xxxxxxxxxxxx> wrote:
>
> Hi Andrew,
>
>   why i want to reference to pointcut defined in other aspects is that,
> i want to be able to " capture the joinpoint that is not captured by any
> other pointcut defined in a set of aspects".
>
>   maybe my i have to revise the InterceptAspect as following:
>
> public aspect InterceptAspect{
>
>  //this advice don't compile, with error message: Syntax error on token ".",
> "name pattern" expected
>
>  // ==> try to capture the method execution in classes in a packages
> "test.mycode" ,
>  //which is not captured by other pointcut defined in ParentAspect and its
> sub-aspects.
>
>  void around(): execution(* test.mycode..*(..)) &&
> !ParentAspect+.monitorPoint(){
>
>    //do something interested
>    System.out.println("This method execution is not captured by other
> aspect, except InterceptAspect");
>
>     proceed();
> }
>
>  i don't know how to achieve this..
>
>  thank you.
>
> ppk


Back to the top