jAdvise supports this.

Bob

On Monday, January 13, 2003, at 07:58 AM, Juozas Baliuka wrote:


As I understand user needs to install ClassLoader provided with JAC to
transforms classes at load time. It can be good to have jdo style feature
to transformation class files at build time too. It must be very trivial:
transform classes the same way as JAC doe's, but have an option to save
output to new file (introduce fields, interfaces, intercept methods), new
classes can be loaded with any ClassLoader without configuration files and
JACClassLoader(If transformed classes doe's not depend on it) .
It is impossible to use custom classloder in some managed applications
(ejb, servlets, classes stored in dabase, loaded by native wrapper ).


"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]>


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


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

Reply via email to