Skip to main content



      Home
Home » Language IDEs » AspectJ » stop the execution of a method
stop the execution of a method [message #665325] Thu, 14 April 2011 06:45 Go to next message
Eclipse UserFriend
Hi,

I want to deny the execution of a method using Aspectj, wath i should put in my advice and my Pointcut.

thanks in advance.
Re: stop the execution of a method [message #667513 is a reply to message #665325] Fri, 29 April 2011 05:41 Go to previous message
Eclipse UserFriend
Am 14.04.2011 12:45, schrieb moha:
> Hi,
>
> I want to deny the execution of a method using Aspectj, wath i should
> put in my advice and my Pointcut.
>
> thanks in advance.

Hi Moha,

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
if (...)
{
return proceed();
}
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.

Best regards,
Alexander
Previous Topic:problem loading plugin org.eclipse.equinox.weaving.springweaver
Next Topic:creating one update site for multiple features?
Goto Forum:
  


Current Time: Tue Jul 22 20:24:41 EDT 2025

Powered by FUDForum. Page generated in 0.03748 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top