[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?
|
- From: Andrew Eisenberg <andrew@xxxxxxxxxxxx>
- Date: Mon, 17 Aug 2009 08:50:40 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:reply-to:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=VtARWS/JPQs3oCWTOkqF9Yhg1xKutoxvhdBXGMEvYRk=; b=vovbn57pOsCy+FUzhsct/uWG4N9Dj3PRYNOglEn6X+OeCyzutXp84Q3l98ovZjTbzY l+oLVaH35KGPjQH89ISmYUL5ae0qe9SHWjmLjtzZUt2hQ/2i4/ys0bv65tjwaJiPcR6D 2n0Yl8AneL/3WR6Gx8dzG9jZku+akTuKqUzCc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=qMuFOVtW7MM0rmvUlANJv9flh4FhKjGEfggdcNqc/ws40kNrS/D1acVR2qOxiS2Qq6 F78KMTB/LShLanqdaPvmoHMIeEaedr5vx5VRjuVlSwIdGlT0IQjQPitxDIdXVF//YB+M H00Ksoi/vBCscyxbpr6U4+Vqw/am1rq8UV3os=
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