• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TAKETODAY / today-infrastructure / 18154768944

01 Oct 2025 07:26AM UTC coverage: 81.882% (-0.005%) from 81.887%
18154768944

push

github

web-flow
Merge pull request #290 from TAKETODAY/dev/jspecify

jspecify

59788 of 78013 branches covered (76.64%)

Branch coverage included in aggregate %.

141239 of 167496 relevant lines covered (84.32%)

3.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
today-context/src/main/java/infra/cache/annotation/CacheAnnotationParser.java
1
/*
2
 * Copyright 2017 - 2025 the original author or authors.
3
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program. If not, see [https://www.gnu.org/licenses/]
16
 */
17

18
package infra.cache.annotation;
19

20
import org.jspecify.annotations.Nullable;
21

22
import java.lang.reflect.Method;
23
import java.util.Collection;
24

25
import infra.cache.interceptor.CacheOperation;
26

27
/**
28
 * Strategy interface for parsing known caching annotation types.
29
 * {@link AnnotationCacheOperationSource} delegates to such parsers
30
 * for supporting specific annotation types such as Framework's own
31
 * {@link Cacheable}, {@link CachePut} and{@link CacheEvict}.
32
 *
33
 * @author Costin Leau
34
 * @author Stephane Nicoll
35
 * @author Juergen Hoeller
36
 * @see AnnotationCacheOperationSource
37
 * @see DefaultCacheAnnotationParser
38
 * @since 4.0
39
 */
40
public interface CacheAnnotationParser {
41

42
  /**
43
   * Determine whether the given class is a candidate for cache operations
44
   * in the annotation format of this {@code CacheAnnotationParser}.
45
   * <p>If this method returns {@code false}, the methods on the given class
46
   * will not get traversed for {@code #parseCacheAnnotations} introspection.
47
   * Returning {@code false} is therefore an optimization for non-affected
48
   * classes, whereas {@code true} simply means that the class needs to get
49
   * fully introspected for each method on the given class individually.
50
   *
51
   * @param targetClass the class to introspect
52
   * @return {@code false} if the class is known to have no cache operation
53
   * annotations at class or method level; {@code true} otherwise. The default
54
   * implementation returns {@code true}, leading to regular introspection.
55
   * @since 4.0
56
   */
57
  default boolean isCandidateClass(Class<?> targetClass) {
58
    return true;
×
59
  }
60

61
  /**
62
   * Parse the cache definition for the given class,
63
   * based on an annotation type understood by this parser.
64
   * <p>This essentially parses a known cache annotation into Framework's metadata
65
   * attribute class. Returns {@code null} if the class is not cacheable.
66
   *
67
   * @param type the annotated class
68
   * @return the configured caching operation, or {@code null} if none found
69
   * @see AnnotationCacheOperationSource#findCacheOperations(Class)
70
   */
71
  @Nullable
72
  Collection<CacheOperation> parseCacheAnnotations(Class<?> type);
73

74
  /**
75
   * Parse the cache definition for the given method,
76
   * based on an annotation type understood by this parser.
77
   * <p>This essentially parses a known cache annotation into Framework's metadata
78
   * attribute class. Returns {@code null} if the method is not cacheable.
79
   *
80
   * @param method the annotated method
81
   * @return the configured caching operation, or {@code null} if none found
82
   * @see AnnotationCacheOperationSource#findCacheOperations(Method)
83
   */
84
  @Nullable
85
  Collection<CacheOperation> parseCacheAnnotations(Method method);
86

87
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc