Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » stop the execution of a method
stop the execution of a method [message #665325] Thu, 14 April 2011 10:45 Go to next message
moha  is currently offline moha Friend
Messages: 43
Registered: March 2011
Member
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 09:41 Go to previous message
Alexander Winter is currently offline Alexander WinterFriend
Messages: 1
Registered: July 2009
Junior Member
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: Thu Dec 14 04:24:23 GMT 2017

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

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