2828import org .springframework .util .ObjectUtils ;
2929
3030/**
31- * Pointcut and method matcher for use in simple <b>cflow</b>-style pointcut.
32- * Note that evaluating such pointcuts is 10-15 times slower than evaluating
31+ * Pointcut and method matcher for use as a simple <b>cflow</b>-style pointcut.
32+ *
33+ * <p>Note that evaluating such pointcuts is 10-15 times slower than evaluating
3334 * normal pointcuts, but they are useful in some cases.
3435 *
3536 * @author Rod Johnson
@@ -45,22 +46,23 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
4546 @ Nullable
4647 private final String methodName ;
4748
48- private final AtomicInteger evaluations = new AtomicInteger ();
49+ private final AtomicInteger evaluationCount = new AtomicInteger ();
4950
5051
5152 /**
52- * Construct a new pointcut that matches all control flows below that class.
53- * @param clazz the clazz
53+ * Construct a new pointcut that matches all control flows below the given class.
54+ * @param clazz the class
5455 */
5556 public ControlFlowPointcut (Class <?> clazz ) {
5657 this (clazz , null );
5758 }
5859
5960 /**
6061 * Construct a new pointcut that matches all calls below the given method
61- * in the given class. If no method name is given, matches all control flows
62+ * in the given class.
63+ * <p>If no method name is given, the pointcut matches all control flows
6264 * below the given class.
63- * @param clazz the clazz
65+ * @param clazz the class
6466 * @param methodName the name of the method (may be {@code null})
6567 */
6668 public ControlFlowPointcut (Class <?> clazz , @ Nullable String methodName ) {
@@ -72,6 +74,7 @@ public ControlFlowPointcut(Class<?> clazz, @Nullable String methodName) {
7274
7375 /**
7476 * Subclasses can override this for greater filtering (and performance).
77+ * <p>The default implementation always returns {@code true}.
7578 */
7679 @ Override
7780 public boolean matches (Class <?> clazz ) {
@@ -80,6 +83,7 @@ public boolean matches(Class<?> clazz) {
8083
8184 /**
8285 * Subclasses can override this if it's possible to filter out some candidate classes.
86+ * <p>The default implementation always returns {@code true}.
8387 */
8488 @ Override
8589 public boolean matches (Method method , Class <?> targetClass ) {
@@ -93,7 +97,7 @@ public boolean isRuntime() {
9397
9498 @ Override
9599 public boolean matches (Method method , Class <?> targetClass , Object ... args ) {
96- this .evaluations .incrementAndGet ();
100+ this .evaluationCount .incrementAndGet ();
97101
98102 for (StackTraceElement element : new Throwable ().getStackTrace ()) {
99103 if (element .getClassName ().equals (this .clazz .getName ()) &&
@@ -105,10 +109,12 @@ public boolean matches(Method method, Class<?> targetClass, Object... args) {
105109 }
106110
107111 /**
108- * It's useful to know how many times we've fired, for optimization.
112+ * Get the number of times {@link #matches(Method, Class, Object...)} has been
113+ * evaluated.
114+ * <p>Useful for optimization and testing purposes.
109115 */
110116 public int getEvaluations () {
111- return this .evaluations .get ();
117+ return this .evaluationCount .get ();
112118 }
113119
114120
0 commit comments