org.springframework.aop.support.DynamicMethodMatcherPointcut Java Examples

The following examples show how to use org.springframework.aop.support.DynamicMethodMatcherPointcut. 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 File: ProxyFactoryBeanTests.java    From spring-analysis-note with 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 File: AbstractAopProxyTests.java    From spring-analysis-note with 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 File: ProxyFactoryBeanTests.java    From java-technology-stack with 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 File: AbstractAopProxyTests.java    From java-technology-stack with 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
Source File: ProxyFactoryBeanTests.java    From spring4-understanding with Apache License 2.0 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, Class<?> targetClass, Object[] args) {
			return m.getReturnType() == Void.TYPE;
		}
	});
}
 
Example #6
Source File: AbstractAopProxyTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
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;
		}
	});
}