>>>>> "Bob" == Bob Lee <[EMAIL PROTECTED]> writes:

  Bob> I think I follow you. Thanks for the clarification. Would you
  Bob> mind posting a small example?

With JAC, you can have an aspect which defines two tracing methods:

  public Object shortTrace(Interaction interaction) {
    System.out.println("invoking "+interaction.method);
    return proceed(interaction);
  }

  public Object timedTrace(Interaction interaction) {
    System.out.println("invoking "+interaction.method);
    Date d1 = new Date();
    Object result = proceed(interaction);
    Date d2 = new Date();
    System.out.println(interaction.method+" call lasted "+
                       (d2.getTime() - d1.getTime()) + " ms");
    return result;
  }

And you can then apply any of these "wrapping" methods to the methods
of your choice, using a configuration file like this (of course, you
can also do this dynamically using the API):

addShortTrace myPackage.myClass "methodA || methodC";
addTimedTrace myPackage.myClass "methodB || methodC";

methodA will only be wrapped with shortTrace, methodB will only be
wrapped with timedTrace and methodC will be wrapped with both. 

This is the basic idea. If you want to know more, this may not be the
right place, so can ask me in private or join the JAC ML
(http://jac.aopsys.com/mailman/listinfo/jac-dev)

Regards,
Laurent

-- 
Laurent Martelli                        http://jac.aopsys.com/
[EMAIL PROTECTED]                    http://www.bearteam.org/~laurent/


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to