From: Adrian B. <adr...@jb...> - 2005-07-29 22:42:01
|
On Fri, 2005-07-29 at 18:10, Clebert Suconic wrote: > What I needed for jboss-serialization It's kind of different, as I > needed to access private fields. I basically do a getDeclaredFields from > classes and change the accessible to true in every field. > If you are not in a constrained environment (where that wouldn't be possible), why not go the whole hog? Avoid reflection and use bytecode engineering to add "writeExternal/readExternal" methods into the class? That avoids breaking the OO encapsulation of those fields and still allows the JIT to optimise access. Some optimizations aren't possible if you make fields public. Ironically, at just the time I sent the original mail, there was also this post about JBPM's reflection model: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=67210 -- xxxxxxxxxxxxxxxxxxxxxxxx Adrian Brock Chief Scientist JBoss Inc. xxxxxxxxxxxxxxxxxxxxxxxx |