Hi Marcos, didn't I already answer some of this in my 26th May mailing list response to you? Including my response below, with further information under that:
On 26 May 2010 08:08, Andy Clement <[email protected]> wrote: > >> Modify the JVM, > > If you mean 'enable it to load time weave' then you have to run with the agent > java -javaagent:aspectjweaver.jar Foo > > If you mean 'weave into the system classes' then I recommend you do > binary weaving > > ajc -inpath rt.jar MyAspect.aj -outjar newrt.jar > (then slap it on the bootclasspath so it is picked up ahead of the old rt.jar) > >> Compile-time > > ajc A.java B.java C.aj -1.5 -showWeaveInfo > // or use AJDT > >> post-compile > > ajc Code.java -outjar code.jar > ajc Aspect.java -outjar aspect.jar > > ajc -inpath code.jar -aspectpath aspect.jar -outjar wovencode.jar > >> load-time > > ajc Code.java > ajc Aspectj.java -outxml -outjar aspect.jar > > java -javaagent:aspectjweaver.jar Code > // if aspect.jar is on the classpath, the aop.xml file inside will be > found and Code will be woven when executing > >> run-time > > we don't do runtime weaving. You either weave something in that can > be switched at runtime (a switchable boolean), or you attempt loadtime > weaving with hotswap, which is experimental > >> if you have code samples >> showing how to use these mechanisms for weaving will help me a lot, so would >> facilitate my understanding; > > more context about what you want to know would help... did you try > the documentation? > > Andy > Marcos wrote: > So I would like to know how to use each of these weaving; > ex: I want to use loadtime what I gotta do to use this waving, I have to > import a library, but less so or would like to know. See above, and see documentation: eg. for loadtime weaving: http://www.eclipse.org/aspectj/doc/next/devguide/ltw.html > If you have any gif or image examples of code weaving dass help me much, so > I would compare them and see how they > work ok, and through the code to have a better sense of what each one does: If you really need to look at the woven code, use javap -verbose. Understanding the woven code isn't really the best approach to learning AOP though, the woven code is just the implementation details. I would recommend looking at the AspectJ documentation. cheers Andy On 14 June 2010 17:50, Marcos Da Costa <[email protected]> wrote: > Hi; > I am starting now aspect-oriented programming; > > I would like to understand more about weaving in aspectj, and if someone > could help me understand a little > about each weaving mechanism with examples of weaving the following code: > > Load-time: > Post-compile: > Compile-time > Modify the JVM: > Run-time: > > So I would like to know how to use each of these weaving; > ex: I want to use loadtime what I gotta do to use this waving, I have to > import a library, but less so or would like to know. > If you have any gif or image examples of code weaving dass help me much, so > I would compare them and see how they > work ok, and through the code to have a better sense of what each one does: > > -- > Att; > Marcos > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
