org.springframework.aop.support
public class: ControlFlowPointcut [javadoc |
source]
java.lang.Object
org.springframework.aop.support.ControlFlowPointcut
All Implemented Interfaces:
Serializable, ClassFilter, Pointcut, MethodMatcher
Pointcut and method matcher for use in simple
cflow-style pointcut.
Note that evaluating such pointcuts is 10-15 times slower than evaluating
normal pointcuts, but they are useful in some cases.
| Constructor: |
public ControlFlowPointcut(Class clazz) {
this(clazz, null);
}
Construct a new pointcut that matches all control flows below that class. Parameters:
clazz - the clazz
|
public ControlFlowPointcut(Class clazz,
String methodName) {
Assert.notNull(clazz, "Class must not be null");
this.clazz = clazz;
this.methodName = methodName;
}
Construct a new pointcut that matches all calls below the
given method in the given class. If the method name is null,
matches all control flows below that class. Parameters:
clazz - the clazz
methodName - the name of the method
|
| Method from org.springframework.aop.support.ControlFlowPointcut Detail: |
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof ControlFlowPointcut)) {
return false;
}
ControlFlowPointcut that = (ControlFlowPointcut) other;
return (this.clazz.equals(that.clazz)) && ObjectUtils.nullSafeEquals(that.methodName, this.methodName);
}
|
public ClassFilter getClassFilter() {
return this;
}
|
public int getEvaluations() {
return evaluations;
}
It's useful to know how many times we've fired, for optimization. |
public MethodMatcher getMethodMatcher() {
return this;
}
|
public int hashCode() {
int code = 17;
code = 37 * code + this.clazz.hashCode();
if (this.methodName != null) {
code = 37 * code + this.methodName.hashCode();
}
return code;
}
|
public boolean isRuntime() {
return true;
}
|
public boolean matches(Class clazz) {
return true;
}
Subclasses can override this for greater filtering (and performance). |
public boolean matches(Method method,
Class targetClass) {
return true;
}
Subclasses can override this if it's possible to filter out
some candidate classes. |
public boolean matches(Method method,
Class targetClass,
Object[] args) {
++this.evaluations;
ControlFlow cflow = ControlFlowFactory.createControlFlow();
return (this.methodName != null) ? cflow.under(this.clazz, this.methodName) : cflow.under(this.clazz);
}
|