クラス CachingMetadataReaderFactory

java.lang.ObjectSE
org.springframework.core.type.classreading.SimpleMetadataReaderFactory
org.springframework.core.type.classreading.CachingMetadataReaderFactory
実装されたすべてのインターフェース:
MetadataReaderFactory

public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory
MetadataReaderFactory インターフェースのキャッシング実装。Spring Resource ハンドルごとに(つまり、".class" ファイルごとに)MetadataReader インスタンスをキャッシングします。
導入:
2.5
作成者:
Juergen Hoeller, Costin Leau
  • フィールドサマリー

    フィールド
    修飾子と型
    フィールド
    説明
    static final int
    ローカル MetadataReader キャッシュのデフォルトの最大エントリ数: 256。
  • コンストラクターのサマリー

    コンストラクター
    コンストラクター
    説明
    ローカルリソースキャッシュを使用して、デフォルトのクラスローダーの新しい CachingMetadataReaderFactory を作成します。
    ローカルリソースキャッシュを使用して、指定された ClassLoaderSE の新しい CachingMetadataReaderFactory を作成します。
    サポートされている場合は共有リソースキャッシュを、サポートされていない場合はローカルリソースキャッシュを使用して、指定された ResourceLoader の新しい CachingMetadataReaderFactory を作成します。
  • メソッドのサマリー

    修飾子と型
    メソッド
    説明
    void
    ローカルの MetadataReader キャッシュがあればクリアし、キャッシュされたすべてのクラスメタデータを削除します。
    int
    MetadataReader キャッシュのエントリの最大数を返します。
    指定されたリソースの MetadataReader を取得します。
    void
    setCacheLimit(int cacheLimit)
    MetadataReader キャッシュの最大エントリ数を指定します。

    クラス org.springframework.core.type.classreading.SimpleMetadataReaderFactory から継承されたメソッド

    getMetadataReader, getResourceLoader

    クラス java.lang.ObjectSE から継承されたメソッド

    clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, toString, wait, waitSE, waitSE
  • フィールドの詳細

    • DEFAULT_CACHE_LIMIT

      public static final int DEFAULT_CACHE_LIMIT
      ローカル MetadataReader キャッシュのデフォルトの最大エントリ数: 256。
      関連事項:
  • コンストラクターの詳細

    • CachingMetadataReaderFactory

      public CachingMetadataReaderFactory()
      ローカルリソースキャッシュを使用して、デフォルトのクラスローダーの新しい CachingMetadataReaderFactory を作成します。
    • CachingMetadataReaderFactory

      public CachingMetadataReaderFactory(@Nullable ClassLoaderSE classLoader)
      ローカルリソースキャッシュを使用して、指定された ClassLoaderSE の新しい CachingMetadataReaderFactory を作成します。
      パラメーター:
      classLoader - 使用する ClassLoader
    • CachingMetadataReaderFactory

      public CachingMetadataReaderFactory(@Nullable ResourceLoader resourceLoader)
      サポートされている場合は共有リソースキャッシュを、サポートされていない場合はローカルリソースキャッシュを使用して、指定された ResourceLoader の新しい CachingMetadataReaderFactory を作成します。
      パラメーター:
      resourceLoader - 使用する Spring ResourceLoader (使用する ClassLoader も決定します)
      関連事項:
  • メソッドの詳細

    • setCacheLimit

      public void setCacheLimit(int cacheLimit)
      MetadataReader キャッシュの最大エントリ数を指定します。

      ローカルキャッシュのデフォルトは 256 ですが、共有キャッシュは通常無制限です。このメソッドは、ResourceLoader が共有リソースキャッシュをサポートしている場合でも、ローカルリソースキャッシュを適用します。

    • getCacheLimit

      public int getCacheLimit()
      MetadataReader キャッシュのエントリの最大数を返します。
    • getMetadataReader

      public MetadataReader getMetadataReader(Resource resource) throws IOExceptionSE
      インターフェースからコピーされた説明: MetadataReaderFactory
      指定されたリソースの MetadataReader を取得します。
      次で指定:
      インターフェース MetadataReaderFactorygetMetadataReader 
      オーバーライド:
      クラス SimpleMetadataReaderFactorygetMetadataReader 
      パラメーター:
      resource - リソース ( ".class" ファイルを指す)
      戻り値:
      ClassReader インスタンスのホルダー (非 null)
      例外:
      ClassFormatException - 互換性のないクラス形式の場合
      IOExceptionSE - I/O 障害の場合
    • clearCache

      public void clearCache()
      ローカルの MetadataReader キャッシュがあればクリアし、キャッシュされたすべてのクラスメタデータを削除します。