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 of
Introspector.getBeanInfo(Class)
, but not the results of
Introspector.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 and Description |
---|
BeanInfoCache() |
Modifier and Type | Method and Description |
---|---|
BeanInfo |
getBeanInfo(Class<?> beanClass,
Class<?> stopClass)
Introspect on a Java bean and return a cached
BeanInfo object. |
static BeanInfo |
getCachedBeanInfo(Class<?> beanClass,
Class<?> stopClass)
Locate an appropriate
BeanInfoCache and return a cached BeanInfo object. |
public BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass) throws IntrospectionException
BeanInfo
object.beanClass
- The bean class to be analyzed.stopClass
- The base class at which to stop the analysis; may be null
.BeanInfo
object describing the target bean.IntrospectionException
- if an exception occurs during introspection.Introspector.getBeanInfo(Class, Class)
public static BeanInfo getCachedBeanInfo(Class<?> beanClass, Class<?> stopClass) throws IntrospectionException
BeanInfoCache
and return a cached BeanInfo
object.
This method ensures that caching the BeanInfo
object will not result in a class
loader leak.beanClass
- The bean class to be analyzed.stopClass
- The base class at which to stop the analysis; may be null
.BeanInfo
object describing the target bean.IntrospectionException
- if an exception occurs during introspection.Copyright © 2004–2018 The Apache Software Foundation. All rights reserved.