Skip to main content

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

Jim:

I am fairly new to aspects as well, but from what I understand you need to do the following:

- define your pointcut to match the log call. I guess you should use the call keyword.
- have the logIsOn boolean in your aspect and set it there
- write an around advice and depending on the evaluation of logIsOn either use proceed() or not.

Andreas

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).

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