本文整理汇总了Java中org.springframework.aop.Pointcut.getClassFilter方法的典型用法代码示例。如果您正苦于以下问题:Java Pointcut.getClassFilter方法的具体用法?Java Pointcut.getClassFilter怎么用?Java Pointcut.getClassFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.aop.Pointcut
的用法示例。
在下文中一共展示了Pointcut.getClassFilter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMatchExplicit
import org.springframework.aop.Pointcut; //导入方法依赖的package包/类
@Test
public void testMatchExplicit() {
String expression = "execution(int org.springframework.tests.sample.beans.TestBean.getAge())";
Pointcut pointcut = getPointcut(expression);
ClassFilter classFilter = pointcut.getClassFilter();
MethodMatcher methodMatcher = pointcut.getMethodMatcher();
assertMatchesTestBeanClass(classFilter);
// not currently testable in a reliable fashion
//assertDoesNotMatchStringClass(classFilter);
assertFalse("Should not be a runtime match", methodMatcher.isRuntime());
assertMatchesGetAge(methodMatcher);
assertFalse("Expression should match setAge() method", methodMatcher.matches(setAge, TestBean.class));
}
示例2: testMatchWithTypePattern
import org.springframework.aop.Pointcut; //导入方法依赖的package包/类
@Test
public void testMatchWithTypePattern() throws Exception {
String expression = "execution(* *..TestBean.*Age(..))";
Pointcut pointcut = getPointcut(expression);
ClassFilter classFilter = pointcut.getClassFilter();
MethodMatcher methodMatcher = pointcut.getMethodMatcher();
assertMatchesTestBeanClass(classFilter);
// not currently testable in a reliable fashion
//assertDoesNotMatchStringClass(classFilter);
assertFalse("Should not be a runtime match", methodMatcher.isRuntime());
assertMatchesGetAge(methodMatcher);
assertTrue("Expression should match setAge(int) method", methodMatcher.matches(setAge, TestBean.class));
}
示例3: testMatchWithArgs
import org.springframework.aop.Pointcut; //导入方法依赖的package包/类
@Test
public void testMatchWithArgs() throws Exception {
String expression = "execution(void org.springframework.tests.sample.beans.TestBean.setSomeNumber(Number)) && args(Double)";
Pointcut pointcut = getPointcut(expression);
ClassFilter classFilter = pointcut.getClassFilter();
MethodMatcher methodMatcher = pointcut.getMethodMatcher();
assertMatchesTestBeanClass(classFilter);
// not currently testable in a reliable fashion
//assertDoesNotMatchStringClass(classFilter);
assertTrue("Should match with setSomeNumber with Double input",
methodMatcher.matches(setSomeNumber, TestBean.class, new Object[]{new Double(12)}));
assertFalse("Should not match setSomeNumber with Integer input",
methodMatcher.matches(setSomeNumber, TestBean.class, new Object[]{new Integer(11)}));
assertFalse("Should not match getAge", methodMatcher.matches(getAge, TestBean.class, null));
assertTrue("Should be a runtime match", methodMatcher.isRuntime());
}
示例4: buildSafePointcut
import org.springframework.aop.Pointcut; //导入方法依赖的package包/类
/**
* Build a 'safe' pointcut that excludes the AspectJ advice method itself.
* @return a composable pointcut that builds on the original AspectJ expression pointcut
* @see #getPointcut()
*/
public final Pointcut buildSafePointcut() {
Pointcut pc = getPointcut();
MethodMatcher safeMethodMatcher = MethodMatchers.intersection(
new AdviceExcludingMethodMatcher(this.aspectJAdviceMethod), pc.getMethodMatcher());
return new ComposablePointcut(pc.getClassFilter(), safeMethodMatcher);
}
示例5: ComposablePointcut
import org.springframework.aop.Pointcut; //导入方法依赖的package包/类
/**
* Create a ComposablePointcut based on the given Pointcut.
* @param pointcut the original Pointcut
*/
public ComposablePointcut(Pointcut pointcut) {
Assert.notNull(pointcut, "Pointcut must not be null");
this.classFilter = pointcut.getClassFilter();
this.methodMatcher = pointcut.getMethodMatcher();
}