public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory
MetadataReaderFactory interface,
 caching a MetadataReader instance per Spring Resource handle
 (i.e. per ".class" file).| Modifier and Type | Field and Description | 
|---|---|
| static int | DEFAULT_CACHE_LIMITDefault maximum number of entries for a local MetadataReader cache: 256. | 
| Constructor and Description | 
|---|
| CachingMetadataReaderFactory()Create a new CachingMetadataReaderFactory for the default class loader,
 using a local resource cache. | 
| CachingMetadataReaderFactory(ClassLoader classLoader)Create a new CachingMetadataReaderFactory for the given  ClassLoader,
 using a local resource cache. | 
| CachingMetadataReaderFactory(ResourceLoader resourceLoader)Create a new CachingMetadataReaderFactory for the given  ResourceLoader,
 using a shared resource cache if supported or a local resource cache otherwise. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | clearCache()Clear the local MetadataReader cache, if any, removing all cached class metadata. | 
| int | getCacheLimit()Return the maximum number of entries for the MetadataReader cache. | 
| MetadataReader | getMetadataReader(Resource resource)Obtain a MetadataReader for the given resource. | 
| void | setCacheLimit(int cacheLimit)Specify the maximum number of entries for the MetadataReader cache. | 
getMetadataReader, getResourceLoaderpublic static final int DEFAULT_CACHE_LIMIT
public CachingMetadataReaderFactory()
public CachingMetadataReaderFactory(@Nullable ClassLoader classLoader)
ClassLoader,
 using a local resource cache.classLoader - the ClassLoader to usepublic CachingMetadataReaderFactory(@Nullable ResourceLoader resourceLoader)
ResourceLoader,
 using a shared resource cache if supported or a local resource cache otherwise.resourceLoader - the Spring ResourceLoader to use
 (also determines the ClassLoader to use)DefaultResourceLoader.getResourceCache(java.lang.Class<T>)public void setCacheLimit(int cacheLimit)
Default is 256 for a local cache, whereas a shared cache is
 typically unbounded. This method enforces a local resource cache,
 even if the ResourceLoader supports a shared resource cache.
public int getCacheLimit()
public MetadataReader getMetadataReader(Resource resource) throws IOException
MetadataReaderFactorygetMetadataReader in interface MetadataReaderFactorygetMetadataReader in class SimpleMetadataReaderFactoryresource - the resource (pointing to a ".class" file)null)IOException - in case of I/O failurepublic void clearCache()