Example usage for org.springframework.cache.annotation CacheAnnotationParser parseCacheAnnotations

List of usage examples for org.springframework.cache.annotation CacheAnnotationParser parseCacheAnnotations

Introduction

In this page you can find the example usage for org.springframework.cache.annotation CacheAnnotationParser parseCacheAnnotations.

Prototype

@Nullable
Collection<CacheOperation> parseCacheAnnotations(Method method);

Source Link

Document

Parse the cache definition for the given method, based on an annotation type understood by this parser.

Usage

From source file:grails.plugin.cache.GrailsAnnotationCacheOperationSource.java

/**
 * Determine the cache operation(s) for the given method or class.
 * <p>This implementation delegates to configured
 * {@link CacheAnnotationParser}s for parsing known annotations into
 * Spring's metadata attribute class.//from   w w w . j av  a2 s. c  om
 * <p>Can be overridden to support custom annotations that carry
 * caching metadata.
 * @param ae the annotated method or class
 * @return the configured caching operations, or {@code null} if none found
 */
protected Collection<CacheOperation> determineCacheOperations(AnnotatedElement ae) {
    Collection<CacheOperation> ops = null;

    for (CacheAnnotationParser annotationParser : annotationParsers) {
        Collection<CacheOperation> annOps = annotationParser.parseCacheAnnotations(ae);
        if (annOps != null) {
            if (ops == null) {
                ops = new ArrayList<CacheOperation>();
            }
            ops.addAll(annOps);
        }
    }

    return ops;
}