Hi,

another little note.

A little while ago I added a MulticastMethodVisitor class which I'm  
actually using more than I expected. It basically allows you to  
easily do independent transformations of methods under different  
method names by starting from the same byte-code. For example:

if ("remove".equals(name) && "(Ljava/lang/Object;)Ljava/lang/ 
Object;".equals(desc)) {
   return new MulticastMethodVisitor(new MethodVisitor[] {
     new SimpleRemoveMethodAdapter(super.visitMethod(access, name,  
desc, signature, exceptions)),
     new ApplicatorRemoveMethodAdapter(super.visitMethod 
(ACC_SYNTHETIC|ACC_PUBLIC, "__tc_applicator_remove", "(Ljava/lang/ 
Object;)V", null, null)),
     new RemoveLogicalMethodAdapter(super.visitMethod(ACC_SYNTHETIC| 
ACC_PUBLIC, "__tc_remove_logical", "(Ljava/lang/Object;)V", null,  
null))});
}

This would instrument the original 'Object remove(Object)' method and  
create two new methods: 'void __tc_applicator_remove(Object)' and  
'void __tc_remove_logical(Object)' from the byte-code of the original  
un-instrumented method and run them through dedicated adaptors.

Thought this might be helpful to illustrate.

Take care,

Geert

--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com

_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev

Reply via email to