Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsHow to access 'this'
https://www.eclipse.org/forums/index.php/mv/msg/14223/45111/#msg_45111
Originally posted by: sekar.gopinathan.fhlbny.com
Hi
I am trying to create an aspect for auditing within our application.
Usually our application has a service object and the service object passes
itself to the auditing service object. So in effect our service object
code would look like
serviceA{
....
execute(...){
//Do the task
auditService.execute(this)
}
Now I want to put the 'auditService.execute(this) into an aspect.
Inside my aspect can I write something like?
public aspect DoAudit {
When I was reading the API spec, I read that for perfomance reasons
getThis should not be used. Is my understanding correct? Or is there
any other way to do the same task. I am not sure if I missed something
from the manual. I appreciate if someone can point me in the right
direction.
Thanks]]>2004-12-20T19:22:51-00:00Re: How to access 'this'
https://www.eclipse.org/forums/index.php/mv/msg/14223/45145/#msg_45145
Originally posted by: newsserver_mails.bodden.de
On Mon, 20 Dec 2004 19:22:51 +0000 (UTC), Sekar Gopinathan wrote:
> public aspect DoAudit {
>
> pointcut doAudit():execution(* AbstractBusinessService.execute);
>
> after():doAudit(){
> auditStep.execute(thisJoinPoint.getThis());
> }
> }
>
> When I was reading the API spec, I read that for perfomance reasons
> getThis should not be used. Is my understanding correct? Or is there
> any other way to do the same task. I am not sure if I missed something
> from the manual. I appreciate if someone can point me in the right
> direction.
Indeed. correct it to:
Then in the pointcut, "this" is bound to the formal s. In the piece of
advice, "sa" is bound to that very instance.
Eric
--
Eric Bodden, ICQ: 12656220, http://www.bodden.de, PGP: BB465582
Active Desktop Wallpaper Changer: That's what it is... http://bodden.de/projects/wpchanger/]]>2004-12-20T22:50:49-00:00Re: How to access 'this'
https://www.eclipse.org/forums/index.php/mv/msg/14223/585360/#msg_585360
> public aspect DoAudit {
>
> pointcut doAudit():execution(* AbstractBusinessService.execute);
>
> after():doAudit(){
> auditStep.execute(thisJoinPoint.getThis());
> }
> }
>
> When I was reading the API spec, I read that for perfomance reasons
> getThis should not be used. Is my understanding correct? Or is there
> any other way to do the same task. I am not sure if I missed something
> from the manual. I appreciate if someone can point me in the right
> direction.
Indeed. correct it to:
Then in the pointcut, "this" is bound to the formal s. In the piece of
advice, "sa" is bound to that very instance.
Eric
--
Eric Bodden, ICQ: 12656220, http://www.bodden.de, PGP: BB465582
Active Desktop Wallpaper Changer: That's what it is... http://bodden.de/projects/wpchanger/]]>Eric Bodden2004-12-20T22:50:49-00:00Re: How to access 'this'
https://www.eclipse.org/forums/index.php/mv/msg/14223/45176/#msg_45176
Originally posted by: sekar.gopinathan.fhlbny.com
Eric,
It worked.
AOP requries one to think very differently. I am getting there.
Thanks you.
Eric Bodden wrote:
> On Mon, 20 Dec 2004 19:22:51 +0000 (UTC), Sekar Gopinathan wrote:
>> public aspect DoAudit {
>>
>> pointcut doAudit():execution(* AbstractBusinessService.execute);
>>
>> after():doAudit(){
>> auditStep.execute(thisJoinPoint.getThis());
>> }
>> }
>>
>> When I was reading the API spec, I read that for perfomance reasons
>> getThis should not be used. Is my understanding correct? Or is there
>> any other way to do the same task. I am not sure if I missed something
>> from the manual. I appreciate if someone can point me in the right
>> direction.
> Indeed. correct it to:
> Then in the pointcut, "this" is bound to the formal s. In the piece of
> advice, "sa" is bound to that very instance.
> Eric]]>2004-12-21T00:28:31-00:00Re: How to access 'this'
https://www.eclipse.org/forums/index.php/mv/msg/14223/585378/#msg_585378
Originally posted by: sekar.gopinathan.fhlbny.com
Eric,
It worked.
AOP requries one to think very differently. I am getting there.
Thanks you.
Eric Bodden wrote:
> On Mon, 20 Dec 2004 19:22:51 +0000 (UTC), Sekar Gopinathan wrote:
>> public aspect DoAudit {
>>
>> pointcut doAudit():execution(* AbstractBusinessService.execute);
>>
>> after():doAudit(){
>> auditStep.execute(thisJoinPoint.getThis());
>> }
>> }
>>
>> When I was reading the API spec, I read that for perfomance reasons
>> getThis should not be used. Is my understanding correct? Or is there
>> any other way to do the same task. I am not sure if I missed something
>> from the manual. I appreciate if someone can point me in the right
>> direction.
> Indeed. correct it to: