Package org.springframework.cache.annotation

# Class SpringCacheAnnotationParser

java.lang.Object
org.springframework.cache.annotation.SpringCacheAnnotationParser

All Implemented Interfaces:
  `Serializable`, `CacheAnnotationParser`

public class SpringCacheAnnotationParser extends Object implements CacheAnnotationParser, Serializable
Strategy implementation for parsing Spring's `Caching`, `Cacheable`, `CacheEvict`, and `CachePut` annotations.

Since:
  3.1
Author:
  Costin Leau, Juergen Hoeller, Chris Beams, Phillip Webb, Stephane Nicoll, Sam Brannen
See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`SpringCacheAnnotationParser()`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object other)`
`int`
`hashCode()`
`boolean`
`isCandidateClass(Class<?> targetClass)`
Determine whether the given class is a candidate for cache operations in the annotation format of this `CacheAnnotationParser`.
`Collection<CacheOperation>`
`parseCacheAnnotations(Class<?> type)`
Parse the cache definition for the given class, based on an annotation type understood by this parser.
`Collection<CacheOperation>`
`parseCacheAnnotations(Method method)`
Parse the cache definition for the given method, based on an annotation type understood by this parser.

### Methods inherited from class java.lang.Object

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

## Constructor Details

### SpringCacheAnnotationParser

public SpringCacheAnnotationParser()

## Method Details

### isCandidateClass

public boolean isCandidateClass(Class<?> targetClass)
Description copied from interface: `CacheAnnotationParser`
Determine whether the given class is a candidate for cache operations in the annotation format of this `CacheAnnotationParser`.

If this method returns `false`, the methods on the given class will not get traversed for `#parseCacheAnnotations` introspection. Returning `false` is therefore an optimization for non-affected classes, whereas `true` simply means that the class needs to get fully introspected for each method on the given class individually.

Specified by:
  `isCandidateClass` in interface `CacheAnnotationParser`
Parameters:
  `targetClass` - the class to introspect
Returns:
  `false` if the class is known to have no cache operation annotations at class or method level; `true` otherwise. The default implementation returns `true`, leading to regular introspection.

### parseCacheAnnotations

@Nullable public Collection<CacheOperation> parseCacheAnnotations(Class<?> type)
Description copied from interface: `CacheAnnotationParser`
Parse the cache definition for the given class, based on an annotation type understood by this parser.

This essentially parses a known cache annotation into Spring's metadata attribute class. Returns `null` if the class is not cacheable.

Specified by:
  `parseCacheAnnotations` in interface `CacheAnnotationParser`
Parameters:
  `type` - the annotated class
Returns:
  the configured caching operation, or `null` if none found
See Also:
  - `AnnotationCacheOperationSource.findCacheOperations(Class)`

### parseCacheAnnotations

@Nullable public Collection<CacheOperation> parseCacheAnnotations(Method method)
Description copied from interface: `CacheAnnotationParser`
Parse the cache definition for the given method, based on an annotation type understood by this parser.

This essentially parses a known cache annotation into Spring's metadata attribute class. Returns `null` if the method is not cacheable.

Specified by:
  `parseCacheAnnotations` in interface `CacheAnnotationParser`
Parameters:
  `method` - the annotated method
Returns:
  the configured caching operation, or `null` if none found
See Also:
  - `AnnotationCacheOperationSource.findCacheOperations(Method)`

### equals

public boolean equals(@Nullable Object other)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`