About Me

My photo
Bangalore, Karnataka, India

Friday, April 2, 2010

Java Beans Introspector

Before we proceed further about the Java.beans.Introspector let me present a statement that, I strongly believe. "Use reflection only as a last option". Most of the cases we use reflection just to reduce the number of lines of code or just to avoid few more classes to be added to the context, some times just not knowing that reflective code executes slower than the normal code. I am open to correct and learn if any of you defer from it.

No doubt javas reflection and java.beans.Introspector very powerful and useful, extensively used in many softwares. Introspector class is standard way for tools to learn about the properties, events, and methods supported by a target Java Bean. Many places I have seen code using the low level reflection where Introspector will be a better candidate. see java.beans.Introspector javadoc for more information.

When ever using Introspector, <Class-Name>BeanInfo is searched first before calculating the BeanInfo for itself.

Last but not the least when ever running applications with different classe loaders, infact in general if we are destroying the ClassLoader or context thumb rule is that we call Introspector.flushCaches().