Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Using AJ to change program flow

Jim Carroll wrote:
I have been playing with AJ; doing some simple things like
> adding tracing to my code base but I wanted to write something
> that would change the program flow based on some criteria and
> I'm not sure if it's supported. As an example I have a lot of
> code with log statements like:

  log.log("some" + " complex" + " string" + " statement);

and I wanted to use AJ to effectively insert a conditional
> in front of each statement like:

   if (logIsOn) log.log("some" + " complex" + " string" + " statement);

which would conditionally change the program flow. I can't seem
>to figure out how to do this (or if it is possible).

maybe i didnt understand your question correctly but what about this...

public aspect BendFlow
{
   public pointcut logging(): execution(public void Logger.log(*));
   around(): logging()
   {
     if (logIsOn)
     {
        proceed();
     }
   }
}

ciao robertj

Any suggestions?

Thanks
Jim Carroll


__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top