Guice/AOP - intercepting a method thanks to its name

410 views
Skip to first unread message

onlytoine

unread,
May 16, 2008, 9:56:12 AM5/16/08
to google-guice
Nothing better than this?

public Object invoke(MethodInvocation mi) throws Throwable {
if (mi.getMethod().getName().equals("getXXXX")) {
// ...
} else {
return mi.proceed();
}
}

Robbie Vanbrabant

unread,
May 16, 2008, 10:37:33 AM5/16/08
to google...@googlegroups.com

Anthony MULLER

unread,
May 16, 2008, 10:50:20 AM5/16/08
to google...@googlegroups.com
Oki, thanks!

2008/5/16 Robbie Vanbrabant <robbie.v...@gmail.com>:

Bob Lee

unread,
May 16, 2008, 11:35:58 AM5/16/08
to google...@googlegroups.com
We prefer to intercept methods using annotations rather than by name. It's more tool friendly and less error prone.

Bob
Reply all
Reply to author
Forward
0 new messages