Class SimpleMetadataReaderFactory
java.lang.Object
org.springframework.core.type.classreading.SimpleMetadataReaderFactory
- All Implemented Interfaces:
MetadataReaderFactory
- Direct Known Subclasses:
CachingMetadataReaderFactory
Simple implementation of the
MetadataReaderFactory
interface,
creating a new ASM ClassReader
for every request.- Since:
- 2.5
- Author:
- Juergen Hoeller
-
Constructor Summary
ConstructorDescriptionCreate a new SimpleMetadataReaderFactory for the default class loader.SimpleMetadataReaderFactory
(ClassLoader classLoader) Create a new SimpleMetadataReaderFactory for the given class loader.SimpleMetadataReaderFactory
(ResourceLoader resourceLoader) Create a new SimpleMetadataReaderFactory for the given resource loader. -
Method Summary
Modifier and TypeMethodDescriptiongetMetadataReader
(String className) Obtain a MetadataReader for the given class name.getMetadataReader
(Resource resource) Obtain a MetadataReader for the given resource.final ResourceLoader
Return the ResourceLoader that this MetadataReaderFactory has been constructed with.
-
Constructor Details
-
SimpleMetadataReaderFactory
public SimpleMetadataReaderFactory()Create a new SimpleMetadataReaderFactory for the default class loader. -
SimpleMetadataReaderFactory
Create a new SimpleMetadataReaderFactory for the given resource loader.- Parameters:
resourceLoader
- the Spring ResourceLoader to use (also determines the ClassLoader to use)
-
SimpleMetadataReaderFactory
Create a new SimpleMetadataReaderFactory for the given class loader.- Parameters:
classLoader
- the ClassLoader to use
-
-
Method Details
-
getResourceLoader
Return the ResourceLoader that this MetadataReaderFactory has been constructed with. -
getMetadataReader
Description copied from interface:MetadataReaderFactory
Obtain a MetadataReader for the given class name.- Specified by:
getMetadataReader
in interfaceMetadataReaderFactory
- Parameters:
className
- the class name (to be resolved to a ".class" file)- Returns:
- a holder for the ClassReader instance (never
null
) - Throws:
IOException
- in case of I/O failure
-
getMetadataReader
Description copied from interface:MetadataReaderFactory
Obtain a MetadataReader for the given resource.- Specified by:
getMetadataReader
in interfaceMetadataReaderFactory
- Parameters:
resource
- the resource (pointing to a ".class" file)- Returns:
- a holder for the ClassReader instance (never
null
) - Throws:
IOException
- in case of I/O failure
-