Getting the name of the method I'm calling

6 views
Skip to first unread message

Quentin

unread,
Aug 6, 2010, 3:41:50 AM8/6/10
to GWT-Ent Developer Forum
Hello,
Using AOP, I would like to create an interceptor which will log the
name of the method I'm calling.

I have been looking for the MethodImpl class, but it can't find this
information !

For exemple, I would like a call of Test.sample() automatically log
"sample"
Is there any solution with GWT-Ent AOP to get the name of the method
we are calling ?

Thanks for your help !

Quentin

James Luo

unread,
Aug 8, 2010, 6:45:28 PM8/8/10
to gwt...@googlegroups.com
Hi, Quentin

  Sorry for reply late.

  for example
{{{
@Before("execution(* com.gwtent.showcase.client.aop.Phone.call(java.lang.Number))")
        public void beforeCall(MethodInvocation invocation) {
            startCallTime.put(getPhoneNumber(invocation), new Date());
        }
}}}

dose "invocation.getMethod().getName()" work?

James


--
You received this message because you are subscribed to the Google Groups "GWT-Ent Developer Forum" group.
To post to this group, send email to gwt...@googlegroups.com.
To unsubscribe from this group, send email to gwt-ent+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwt-ent?hl=en.




--
Regards
James Luo

Quentin

unread,
Aug 9, 2010, 3:38:07 AM8/9/10
to GWT-Ent Developer Forum
Hi,
Yep, that works now, thanks for the answer.
I get some error because my method "call" had primitive types, so I
get an error when I try to intercept it. Works well with call (Integer
i) instead of call (int i)
> > gwt-ent+u...@googlegroups.com<gwt-ent%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages