Polishing

(cherry picked from commit 8e571decc1)
This commit is contained in:
Juergen Hoeller
2018-08-09 11:59:15 +02:00
parent 1d45e326b7
commit 42dbc39032
6 changed files with 68 additions and 70 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,41 +24,40 @@ import org.springframework.lang.Nullable;
/**
* Strategy interface for parsing known caching annotation types.
* {@link AnnotationCacheOperationSource} delegates to such
* parsers for supporting specific annotation types such as Spring's own
* {@link Cacheable}, {@link CachePut} or {@link CacheEvict}.
* {@link AnnotationCacheOperationSource} delegates to such parsers
* for supporting specific annotation types such as Spring's own
* {@link Cacheable}, {@link CachePut} and{@link CacheEvict}.
*
* @author Costin Leau
* @author Stephane Nicoll
* @since 3.1
* @see AnnotationCacheOperationSource
* @see SpringCacheAnnotationParser
*/
public interface CacheAnnotationParser {
/**
* Parses the cache definition for the given class,
* based on a known annotation type.
* <p>This essentially parses a known cache annotation into Spring's
* metadata attribute class. Returns {@code null} if the class
* is not cacheable.
* Parse the cache definition for the given class,
* based on an annotation type understood by this parser.
* <p>This essentially parses a known cache annotation into Spring's metadata
* attribute class. Returns {@code null} if the class is not cacheable.
* @param type the annotated class
* @return CacheOperation the configured caching operation,
* or {@code null} if none was found
* @return the configured caching operation, or {@code null} if none found
* @see AnnotationCacheOperationSource#findCacheOperations(Class)
*/
@Nullable
Collection<CacheOperation> parseCacheAnnotations(Class<?> type);
/**
* Parses the cache definition for the given method,
* based on a known annotation type.
* <p>This essentially parses a known cache annotation into Spring's
* metadata attribute class. Returns {@code null} if the method
* is not cacheable.
* Parse the cache definition for the given method,
* based on an annotation type understood by this parser.
* <p>This essentially parses a known cache annotation into Spring's metadata
* attribute class. Returns {@code null} if the method is not cacheable.
* @param method the annotated method
* @return CacheOperation the configured caching operation,
* or {@code null} if none was found
* @return the configured caching operation, or {@code null} if none found
* @see AnnotationCacheOperationSource#findCacheOperations(Method)
*/
@Nullable
Collection<CacheOperation> parseCacheAnnotations(Method method);
}

View File

@@ -163,25 +163,23 @@ public abstract class AbstractFallbackCacheOperationSource implements CacheOpera
/**
* Subclasses need to implement this to return the caching attribute
* for the given method, if any.
* @param method the method to retrieve the attribute for
* @return all caching attribute associated with this method
* (or {@code null} if none)
*/
@Nullable
protected abstract Collection<CacheOperation> findCacheOperations(Method method);
/**
* Subclasses need to implement this to return the caching attribute
* for the given class, if any.
* Subclasses need to implement this to return the caching attribute for the
* given class, if any.
* @param clazz the class to retrieve the attribute for
* @return all caching attribute associated with this class
* (or {@code null} if none)
* @return all caching attribute associated with this class, or {@code null} if none
*/
@Nullable
protected abstract Collection<CacheOperation> findCacheOperations(Class<?> clazz);
/**
* Subclasses need to implement this to return the caching attribute for the
* given method, if any.
* @param method the method to retrieve the attribute for
* @return all caching attribute associated with this method, or {@code null} if none
*/
@Nullable
protected abstract Collection<CacheOperation> findCacheOperations(Method method);
/**
* Should only public methods be allowed to have caching semantics?
* <p>The default implementation returns {@code false}.