patching java reflect calls using AOP

Posted by Oleg Pavliv on Stack Overflow See other posts from Stack Overflow or by Oleg Pavliv
Published on 2010-06-15T08:42:07Z Indexed on 2010/06/15 10:22 UTC
Read the original article Hit count: 232

Filed under:
|
|

I don't have a lot of experience with Jboss AOP and I'm just curious if it's possible to replace all calls like

Field f = foo.class.getDeclaredField("bar");
f.set(object, value);

with something like

Field f = foo.class.getDeclaredField("bar");
FieldSetCaller.invoke(f, object, value);

using Jboss AOP. FieldSetCaller is my own class.

I need to replace all Field.set calls on the fly, without recompiling the code. Some third -party code I even cannot recompile because I don't have the source.

I can achieve this using java asm framework and I'm wandering if Jboss AOP can do it as well.

Just for information - my code is running on Jboss server 4.3.0

© Stack Overflow or respective owner

Related posts about java

Related posts about jboss