Spring Framework

org.springframework.core.type.classreading
Class SimpleMetadataReaderFactory

java.lang.Object
  extended by org.springframework.core.type.classreading.SimpleMetadataReaderFactory
All Implemented Interfaces:
MetadataReaderFactory
Direct Known Subclasses:
CachingMetadataReaderFactory

public class SimpleMetadataReaderFactory
extends java.lang.Object
implements MetadataReaderFactory

Simple implementation of the MetadataReaderFactory interface, creating a new ASM ClassReader for every request.

Since:
2.5
Author:
Juergen Hoeller

Constructor Summary
SimpleMetadataReaderFactory()
          Create a new SimpleMetadataReaderFactory for the default class loader.
SimpleMetadataReaderFactory(java.lang.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
 MetadataReader getMetadataReader(Resource resource)
          Obtain a MetadataReader for the given resource.
 MetadataReader getMetadataReader(java.lang.String className)
          Obtain a MetadataReader for the given class name.
 ResourceLoader getResourceLoader()
          Return the ResourceLoader that this MetadataReaderFactory has been constructed with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMetadataReaderFactory

public SimpleMetadataReaderFactory()
Create a new SimpleMetadataReaderFactory for the default class loader.


SimpleMetadataReaderFactory

public SimpleMetadataReaderFactory(ResourceLoader resourceLoader)
Create a new SimpleMetadataReaderFactory for the given resource loader.

Parameters:
resourceLoader - the Spring ResourceLoader to use (also determines the ClassLoader to use)

SimpleMetadataReaderFactory

public SimpleMetadataReaderFactory(java.lang.ClassLoader classLoader)
Create a new SimpleMetadataReaderFactory for the given class loader.

Parameters:
classLoader - the ClassLoader to use
Method Detail

getResourceLoader

public final ResourceLoader getResourceLoader()
Return the ResourceLoader that this MetadataReaderFactory has been constructed with.


getMetadataReader

public MetadataReader getMetadataReader(java.lang.String className)
                                 throws java.io.IOException
Description copied from interface: MetadataReaderFactory
Obtain a MetadataReader for the given class name.

Specified by:
getMetadataReader in interface MetadataReaderFactory
Parameters:
className - the class name (to be resolved to a ".class" file)
Returns:
a holder for the ClassReader instance (never null)
Throws:
java.io.IOException - in case of I/O failure

getMetadataReader

public MetadataReader getMetadataReader(Resource resource)
                                 throws java.io.IOException
Description copied from interface: MetadataReaderFactory
Obtain a MetadataReader for the given resource.

Specified by:
getMetadataReader in interface MetadataReaderFactory
Parameters:
resource - the resource (pointing to a ".class" file)
Returns:
a holder for the ClassReader instance (never null)
Throws:
java.io.IOException - in case of I/O failure

Spring Framework