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_LIMIT
Default maximum number of entries for the MetadataReader cache: 256
|
| Constructor and Description |
|---|
CachingMetadataReaderFactory()
Create a new CachingMetadataReaderFactory for the default class loader.
|
CachingMetadataReaderFactory(ClassLoader classLoader)
Create a new CachingMetadataReaderFactory for the given class loader.
|
CachingMetadataReaderFactory(ResourceLoader resourceLoader)
Create a new CachingMetadataReaderFactory for the given resource loader.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
Clear the entire MetadataReader cache, 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(ResourceLoader resourceLoader)
resourceLoader - the Spring ResourceLoader to use
(also determines the ClassLoader to use)public CachingMetadataReaderFactory(ClassLoader classLoader)
classLoader - the ClassLoader to usepublic void setCacheLimit(int cacheLimit)
Default is 256.
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()