[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] A very simple question

Use the this pointcut descriptor, e.g.,

pointcut p(Foo foo) : 
    execution(public void com.Foo.doThis(..)) && this(foo);

after(Foo foo) : p(foo) {
 Â// foo is the currently executing object at the join point
   // picked out by p 
   foo.doSomething();
}

See the AspectJ Programmer Guide for more details, e.g., http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/progguide/language-joinPoints.html

Ron Bodkin
Chief Technology Officer
New Aspects of Software
o: (415) 824-4690
m: (415) 509-2895


> ------------Original Message------------
> From: Jhst463@xxxxxxx
> To: aspectj-users@xxxxxxxxxxx
> Date: Thu, Sep-9-2004 9:36 PM
> Subject: [aspectj-users] A very simple question
>
> Hello, I'm very new to AspectJ, and I have a very simple question: 
>     How do I get a reference to the object my pointcut is weaving into? 
>  
> 
> For example:
> 
> pointcut p() : execution(public void com.Foo.doThis(..));
> 
> after() : p() {
>     // this where I need the instance of Foo specified by p()
> 
>     
> }
> 
> 
> I tried using thisJoinPoint.getTarget() but I get errors.  Using v1.1 I 
> got 
> one type of error and for v1.2 I got another.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
>