当前位置: 首页>>代码示例>>Java>>正文


Java Pointcut.getClassFilter方法代码示例

本文整理汇总了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));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:AspectJExpressionPointcutTests.java

示例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));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:AspectJExpressionPointcutTests.java

示例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());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:21,代码来源:AspectJExpressionPointcutTests.java

示例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);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:AbstractAspectJAdvice.java

示例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();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:ComposablePointcut.java


注:本文中的org.springframework.aop.Pointcut.getClassFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。