public class ConcurrentReferenceCachingMetadataReaderFactory extends SimpleMetadataReaderFactory
MetadataReaderFactory
interface backed by a
ConcurrentReferenceHashMap
, caching MetadataReader
per Spring
Resource
handle (i.e. per ".class" file).CachingMetadataReaderFactory
Constructor and Description |
---|
ConcurrentReferenceCachingMetadataReaderFactory()
Create a new
ConcurrentReferenceCachingMetadataReaderFactory instance for
the default class loader. |
ConcurrentReferenceCachingMetadataReaderFactory(ClassLoader classLoader)
Create a new
ConcurrentReferenceCachingMetadataReaderFactory instance for
the given class loader. |
ConcurrentReferenceCachingMetadataReaderFactory(ResourceLoader resourceLoader)
Create a new
ConcurrentReferenceCachingMetadataReaderFactory instance for
the given resource loader. |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clear the entire MetadataReader cache, removing all cached class metadata.
|
protected MetadataReader |
createMetadataReader(Resource resource)
Create the meta-data reader.
|
MetadataReader |
getMetadataReader(Resource resource) |
getMetadataReader, getResourceLoader
public ConcurrentReferenceCachingMetadataReaderFactory()
ConcurrentReferenceCachingMetadataReaderFactory
instance for
the default class loader.public ConcurrentReferenceCachingMetadataReaderFactory(ResourceLoader resourceLoader)
ConcurrentReferenceCachingMetadataReaderFactory
instance for
the given resource loader.resourceLoader
- the Spring ResourceLoader to use (also determines the
ClassLoader to use)public ConcurrentReferenceCachingMetadataReaderFactory(ClassLoader classLoader)
ConcurrentReferenceCachingMetadataReaderFactory
instance for
the given class loader.classLoader
- the ClassLoader to usepublic MetadataReader getMetadataReader(Resource resource) throws IOException
getMetadataReader
in interface MetadataReaderFactory
getMetadataReader
in class SimpleMetadataReaderFactory
IOException
protected MetadataReader createMetadataReader(Resource resource) throws IOException
resource
- the source resource.IOException
- on errorpublic void clearCache()