Package org.apache.axis2.classloader
Class BeanInfoCache
- java.lang.Object
-
- org.apache.axis2.classloader.BeanInfoCache
-
public final class BeanInfoCache extends Object
BeanInfo
cache that stores introspection results by bean class and stop class. This goes beyond the caching provided by the JRE, which only caches the results ofIntrospector.getBeanInfo(Class)
, but not the results ofIntrospector.getBeanInfo(Class, Class)
(with non null stop class).To avoid class loader leaks, this class should not be used as a singleton if the introspected classes are loaded from class loaders that are children of the class loader which holds the reference to the cache. In such scenarios, use
getCachedBeanInfo(Class, Class)
.
-
-
Constructor Summary
Constructors Constructor Description BeanInfoCache()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BeanInfo
getBeanInfo(Class<?> beanClass, Class<?> stopClass)
Introspect on a Java bean and return a cachedBeanInfo
object.static BeanInfo
getCachedBeanInfo(Class<?> beanClass, Class<?> stopClass)
Locate an appropriateBeanInfoCache
and return a cachedBeanInfo
object.
-
-
-
Method Detail
-
getBeanInfo
public BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass) throws IntrospectionException
Introspect on a Java bean and return a cachedBeanInfo
object.- Parameters:
beanClass
- The bean class to be analyzed.stopClass
- The base class at which to stop the analysis; may benull
.- Returns:
- A
BeanInfo
object describing the target bean. - Throws:
IntrospectionException
- if an exception occurs during introspection.- See Also:
Introspector.getBeanInfo(Class, Class)
-
getCachedBeanInfo
public static BeanInfo getCachedBeanInfo(Class<?> beanClass, Class<?> stopClass) throws IntrospectionException
Locate an appropriateBeanInfoCache
and return a cachedBeanInfo
object. This method ensures that caching theBeanInfo
object will not result in a class loader leak.- Parameters:
beanClass
- The bean class to be analyzed.stopClass
- The base class at which to stop the analysis; may benull
.- Returns:
- A
BeanInfo
object describing the target bean. - Throws:
IntrospectionException
- if an exception occurs during introspection.
-
-