I'm currently using Java Reflection to achieve reflective property. I understand there are many a tool to achieve reflection property. One among them is: Javassist, which along with the behavioral reflection, provides structural reflection. However, I'm concerned only about behavioral reflection.
My question is: which among the existing libraries (Java reflection/Javassist/any other) would be good at achieving behavioral reflection? I'm worried only about the performance (i.e. the speed at which they act).
Thanks in advance.
If you just need introspection, then use java.lang.reflect or java.beans. Alternatively, you can use some higher-level utilities like commons-beanutils.
Check out these articles:
https://community.jboss.org/thread/94356
http://www.ibm.com/developerworks/library/j-dyn0610/
Javassist is much faster if your code needs high throughput for accessing methods or fields, and load time is not critical for you.
If you are using JDK1.7, you can take advantage of InvokeDynamic with almost the same performance as calling the method directly, hence no need for javassist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With