Java Code Examples for org.springframework.aop.support.DynamicMethodMatcherPointcut

The following examples show how to use org.springframework.aop.support.DynamicMethodMatcherPointcut. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: ProxyFactoryBeanTests.java    License: MIT License 5 votes vote down vote up
public PointcutForVoid() {
	setAdvice(new MethodInterceptor() {
		@Override
		public Object invoke(MethodInvocation invocation) throws Throwable {
			methodNames.add(invocation.getMethod().getName());
			return invocation.proceed();
		}
	});
	setPointcut(new DynamicMethodMatcherPointcut() {
		@Override
		public boolean matches(Method m, @Nullable Class<?> targetClass, Object... args) {
			return m.getReturnType() == Void.TYPE;
		}
	});
}
 
Example 2
Source Project: spring-analysis-note   Source File: AbstractAopProxyTests.java    License: MIT License 5 votes vote down vote up
public TestDynamicPointcutAdvice(MethodInterceptor mi, final String pattern) {
	super(mi);
	setPointcut(new DynamicMethodMatcherPointcut() {
		@Override
		public boolean matches(Method m, @Nullable Class<?> targetClass, Object... args) {
			boolean run = m.getName().contains(pattern);
			if (run) ++count;
			return run;
		}
	});
}
 
Example 3
Source Project: java-technology-stack   Source File: ProxyFactoryBeanTests.java    License: MIT License 5 votes vote down vote up
public PointcutForVoid() {
	setAdvice(new MethodInterceptor() {
		@Override
		public Object invoke(MethodInvocation invocation) throws Throwable {
			methodNames.add(invocation.getMethod().getName());
			return invocation.proceed();
		}
	});
	setPointcut(new DynamicMethodMatcherPointcut() {
		@Override
		public boolean matches(Method m, @Nullable Class<?> targetClass, Object... args) {
			return m.getReturnType() == Void.TYPE;
		}
	});
}
 
Example 4
Source Project: java-technology-stack   Source File: AbstractAopProxyTests.java    License: MIT License 5 votes vote down vote up
public TestDynamicPointcutAdvice(MethodInterceptor mi, final String pattern) {
	super(mi);
	setPointcut(new DynamicMethodMatcherPointcut() {
		@Override
		public boolean matches(Method m, @Nullable Class<?> targetClass, Object... args) {
			boolean run = m.getName().contains(pattern);
			if (run) ++count;
			return run;
		}
	});
}
 
Example 5
public PointcutForVoid() {
	setAdvice(new MethodInterceptor() {
		@Override
		public Object invoke(MethodInvocation invocation) throws Throwable {
			methodNames.add(invocation.getMethod().getName());
			return invocation.proceed();
		}
	});
	setPointcut(new DynamicMethodMatcherPointcut() {
		@Override
		public boolean matches(Method m, Class<?> targetClass, Object[] args) {
			return m.getReturnType() == Void.TYPE;
		}
	});
}
 
Example 6
public TestDynamicPointcutAdvice(MethodInterceptor mi, final String pattern) {
	super(mi);
	setPointcut(new DynamicMethodMatcherPointcut() {
		@Override
		public boolean matches(Method m, Class<?> targetClass, Object[] args) {
			boolean run = m.getName().indexOf(pattern) != -1;
			if (run) ++count;
			return run;
		}
	});
}