public class

CachingMetadataReaderFactory

extends SimpleMetadataReaderFactory
java.lang.Object
   ↳ org.springframework.core.type.classreading.SimpleMetadataReaderFactory
     ↳ org.springframework.core.type.classreading.CachingMetadataReaderFactory

Class Overview

Caching implementation of the MetadataReaderFactory interface, caching MetadataReader per Spring Resource handle (i.e. per ".class" file).

Summary

Constants
int DEFAULT_CACHE_LIMIT Default maximum number of entries for the MetadataReader cache: 256
Public Constructors
CachingMetadataReaderFactory()
Create a new CachingMetadataReaderFactory for the default class loader.
CachingMetadataReaderFactory(ResourceLoader resourceLoader)
Create a new CachingMetadataReaderFactory for the given resource loader.
CachingMetadataReaderFactory(ClassLoader classLoader)
Create a new CachingMetadataReaderFactory for the given class loader.
Public Methods
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.
[Expand]
Inherited Methods
From class org.springframework.core.type.classreading.SimpleMetadataReaderFactory
From class java.lang.Object
From interface org.springframework.core.type.classreading.MetadataReaderFactory

Constants

public static final int DEFAULT_CACHE_LIMIT

Also: SpringCore

Default maximum number of entries for the MetadataReader cache: 256

Constant Value: 256 (0x00000100)

Public Constructors

public CachingMetadataReaderFactory ()

Also: SpringCore

Create a new CachingMetadataReaderFactory for the default class loader.

public CachingMetadataReaderFactory (ResourceLoader resourceLoader)

Also: SpringCore

Create a new CachingMetadataReaderFactory for the given resource loader.

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

public CachingMetadataReaderFactory (ClassLoader classLoader)

Also: SpringCore

Create a new CachingMetadataReaderFactory for the given class loader.

Parameters
classLoader the ClassLoader to use

Public Methods

public int getCacheLimit ()

Also: SpringCore

Return the maximum number of entries for the MetadataReader cache.

public MetadataReader getMetadataReader (Resource resource)

Also: SpringCore

Obtain a MetadataReader for the given resource.

Parameters
resource the resource (pointing to a ".class" file)
Returns
  • a holder for the ClassReader instance (never null)
Throws
IOException

public void setCacheLimit (int cacheLimit)

Also: SpringCore

Specify the maximum number of entries for the MetadataReader cache. Default is 256.