|Re: stop the execution of a method [message #667513 is a reply to message #665325]
||Fri, 29 April 2011 09:41
| Alexander Winter
Registered: July 2009
Am 14.04.2011 12:45, schrieb moha:|
> I want to deny the execution of a method using Aspectj, wath i should
> put in my advice and my Pointcut.
> thanks in advance.
I started looking into AspectJ myself and can not call myself and
expert, but how about an around advice, something like:
pointcut methodExecution() : execution(....);
Object around() : methodExecution()
// check if some condition is fulfilled for executing the method
return ... ;
With this solution, you can skip the execution (denying would be rather
to throw a runtime exception within the advice). Of course, you need to
decide what give back if the caller expects some result, so that is not
easy for a general method call.
Powered by FUDForum
. Page generated in 0.01878 seconds