[jboss-user] [Javassist Users] - Field access like in GluonJ

Corifeo do-not-reply at jboss.com
Mon Sep 14 11:51:18 EDT 2009

I try to implement a field access as the @Get and @Set Listener-Annotations in GluonJ, directly with Javassist.
I looked into the source code how GluonJ performs this, but I can't get it running - and don't get the exact point.

e.g. Class A
   String myString;

Does anybody know:
- is it possible to only modify Class A, e.g. by injecting a bytecode method invocation, to 'redirect' every possible access (set/get) on myString? Does GluonJ so? I found snippets like 'constPool.addMethodrefInfo(classIndex, nt); or 'codeConverter2.redirectFieldAccess(superOf, m.getDeclaringClass(), fname);

- Or is it only possible to substitute the field accesses in specified classes/methods, and GluonJ substitute these brute-force in every class that is processed by the class loader...which is not so elegant, but perhaps the only possibility

- What are the necessary Javassist invocations to achieve such Listeners? I can't find an according snippet in the tutorial. Is it possible to paste one here?

Thanks in advance!


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255136#4255136

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4255136

More information about the jboss-user mailing list