org.springframework.cache.annotation

## 类 AnnotationCacheOperationSource

- java.lang.Object
- - org.springframework.cache.interceptor.AbstractFallbackCacheOperationSource
  - - org.springframework.cache.annotation.AnnotationCacheOperationSource

- 所有已实现的接口:
    Serializable, CacheOperationSource

      public class AnnotationCacheOperationSource
      extends AbstractFallbackCacheOperationSource
      implements Serializable

  Implementation of the `CacheOperationSource` interface for working with caching metadata in annotation format.

  This class reads Spring's `Cacheable`, `CachePut` and `CacheEvict` annotations and exposes corresponding caching operation definition to Spring's cache infrastructure. This class may also serve as base class for a custom `CacheOperationSource`.

  从以下版本开始:
    3.1
  作者:
    Costin Leau, Juergen Hoeller, Stephane Nicoll
  另请参阅:
    序列化表格

- - ### 嵌套类概要

    嵌套类
    限定符和类型 | 类和说明
    --- | ---
    `protected static interface` | `AnnotationCacheOperationSource.CacheOperationProvider` Callback interface providing `CacheOperation` instance(s) based on a given `CacheAnnotationParser`.

  - ### 字段概要

    - ### 从类继承的字段 org.springframework.cache.interceptor.AbstractFallbackCacheOperationSource

      `logger`

  - ### 构造器概要

    构造器
    构造器和说明
    `AnnotationCacheOperationSource()` Create a default AnnotationCacheOperationSource, supporting public methods that carry the `Cacheable` and `CacheEvict` annotations.
    `AnnotationCacheOperationSource(boolean publicMethodsOnly)` Create a default `AnnotationCacheOperationSource`, supporting public methods that carry the `Cacheable` and `CacheEvict` annotations.
    `AnnotationCacheOperationSource(CacheAnnotationParser... annotationParsers)` Create a custom AnnotationCacheOperationSource.
    `AnnotationCacheOperationSource(CacheAnnotationParser annotationParser)` Create a custom AnnotationCacheOperationSource.
    `AnnotationCacheOperationSource(Set<CacheAnnotationParser> annotationParsers)` Create a custom AnnotationCacheOperationSource.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected boolean` | `allowPublicMethodsOnly()` By default, only public methods can be made cacheable.
    `protected Collection<CacheOperation>` | `determineCacheOperations(AnnotationCacheOperationSource.CacheOperationProvider provider)` Determine the cache operation(s) for the given `AnnotationCacheOperationSource.CacheOperationProvider`.
    `boolean` | `equals(Object other)`
    `protected Collection<CacheOperation>` | `findCacheOperations(Class<?> clazz)` Subclasses need to implement this to return the caching attribute for the given class, if any.
    `protected Collection<CacheOperation>` | `findCacheOperations(Method method)` Subclasses need to implement this to return the caching attribute for the given method, if any.
    `int` | `hashCode()`

    - ### 从类继承的方法 org.springframework.cache.interceptor.AbstractFallbackCacheOperationSource

      `getCacheKey, getCacheOperations`

    - ### 从类继承的方法 java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### AnnotationCacheOperationSource

          public AnnotationCacheOperationSource()

      Create a default AnnotationCacheOperationSource, supporting public methods that carry the `Cacheable` and `CacheEvict` annotations.

    - #### AnnotationCacheOperationSource

          public AnnotationCacheOperationSource(boolean publicMethodsOnly)

      Create a default `AnnotationCacheOperationSource`, supporting public methods that carry the `Cacheable` and `CacheEvict` annotations.
      参数:
        `publicMethodsOnly` - whether to support only annotated public methods typically for use with proxy-based AOP), or protected/private methods as well (typically used with AspectJ class weaving)

    - #### AnnotationCacheOperationSource

          public AnnotationCacheOperationSource(CacheAnnotationParser annotationParser)

      Create a custom AnnotationCacheOperationSource.
      参数:
        `annotationParser` - the CacheAnnotationParser to use

    - #### AnnotationCacheOperationSource

          public AnnotationCacheOperationSource(CacheAnnotationParser... annotationParsers)

      Create a custom AnnotationCacheOperationSource.
      参数:
        `annotationParsers` - the CacheAnnotationParser to use

    - #### AnnotationCacheOperationSource

          public AnnotationCacheOperationSource(Set<CacheAnnotationParser> annotationParsers)

      Create a custom AnnotationCacheOperationSource.
      参数:
        `annotationParsers` - the CacheAnnotationParser to use

  - ### 方法详细资料

    - #### findCacheOperations

          @Nullable
          protected Collection<CacheOperation> findCacheOperations(Class<?> clazz)

      从类复制的说明: `AbstractFallbackCacheOperationSource`
      Subclasses need to implement this to return the caching attribute for the given class, if any.
      指定者:
        `findCacheOperations` 在类中 `AbstractFallbackCacheOperationSource`
      参数:
        `clazz` - the class to retrieve the attribute for
      返回:
        all caching attribute associated with this class, or `null` if none

    - #### findCacheOperations

          @Nullable
          protected Collection<CacheOperation> findCacheOperations(Method method)

      从类复制的说明: `AbstractFallbackCacheOperationSource`
      Subclasses need to implement this to return the caching attribute for the given method, if any.
      指定者:
        `findCacheOperations` 在类中 `AbstractFallbackCacheOperationSource`
      参数:
        `method` - the method to retrieve the attribute for
      返回:
        all caching attribute associated with this method, or `null` if none

    - #### determineCacheOperations

          @Nullable
          protected Collection<CacheOperation> determineCacheOperations(AnnotationCacheOperationSource.CacheOperationProvider provider)

      Determine the cache operation(s) for the given `AnnotationCacheOperationSource.CacheOperationProvider`.

      This implementation delegates to configured `CacheAnnotationParsers` for parsing known annotations into Spring's metadata attribute class.

      Can be overridden to support custom annotations that carry caching metadata.

      参数:
        `provider` - the cache operation provider to use
      返回:
        the configured caching operations, or `null` if none found

    - #### allowPublicMethodsOnly

          protected boolean allowPublicMethodsOnly()

      By default, only public methods can be made cacheable.
      覆盖:
        `allowPublicMethodsOnly` 在类中 `AbstractFallbackCacheOperationSource`

    - #### equals

          public boolean equals(Object other)

      覆盖:
        `equals` 在类中 `Object`

    - #### hashCode

          public int hashCode()

      覆盖:
        `hashCode` 在类中 `Object`