Java Code Examples for org.springframework.aop.ClassFilter#TRUE

The following examples show how to use org.springframework.aop.ClassFilter#TRUE . 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: MethodMatchers.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
public boolean equals(Object other) {
	if (this == other) {
		return true;
	}
	if (!super.equals(other)) {
		return false;
	}
	ClassFilter otherCf1 = ClassFilter.TRUE;
	ClassFilter otherCf2 = ClassFilter.TRUE;
	if (other instanceof ClassFilterAwareUnionMethodMatcher) {
		ClassFilterAwareUnionMethodMatcher cfa = (ClassFilterAwareUnionMethodMatcher) other;
		otherCf1 = cfa.cf1;
		otherCf2 = cfa.cf2;
	}
	return (this.cf1.equals(otherCf1) && this.cf2.equals(otherCf2));
}
 
Example 2
Source File: AnnotationMatchingPointcut.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Create a new AnnotationMatchingPointcut for the given annotation type.
 * @param classAnnotationType the annotation type to look for at the class level
 * (can be {@code null})
 * @param methodAnnotationType the annotation type to look for at the method level
 * (can be {@code null})
 */
public AnnotationMatchingPointcut(
		Class<? extends Annotation> classAnnotationType, Class<? extends Annotation> methodAnnotationType) {

	Assert.isTrue((classAnnotationType != null || methodAnnotationType != null),
			"Either Class annotation type or Method annotation type needs to be specified (or both)");

	if (classAnnotationType != null) {
		this.classFilter = new AnnotationClassFilter(classAnnotationType);
	}
	else {
		this.classFilter = ClassFilter.TRUE;
	}

	if (methodAnnotationType != null) {
		this.methodMatcher = new AnnotationMethodMatcher(methodAnnotationType);
	}
	else {
		this.methodMatcher = MethodMatcher.TRUE;
	}
}
 
Example 3
Source File: AnnotationMatchingPointcut.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Create a new AnnotationMatchingPointcut for the given annotation type.
 * @param classAnnotationType the annotation type to look for at the class level
 * (can be {@code null})
 * @param methodAnnotationType the annotation type to look for at the method level
 * (can be {@code null})
 * @param checkInherited whether to also check the superclasses and interfaces
 * as well as meta-annotations for the annotation type
 * @since 5.0
 * @see AnnotationClassFilter#AnnotationClassFilter(Class, boolean)
 * @see AnnotationMethodMatcher#AnnotationMethodMatcher(Class, boolean)
 */
public AnnotationMatchingPointcut(@Nullable Class<? extends Annotation> classAnnotationType,
		@Nullable Class<? extends Annotation> methodAnnotationType, boolean checkInherited) {

	Assert.isTrue((classAnnotationType != null || methodAnnotationType != null),
			"Either Class annotation type or Method annotation type needs to be specified (or both)");

	if (classAnnotationType != null) {
		this.classFilter = new AnnotationClassFilter(classAnnotationType, checkInherited);
	}
	else {
		this.classFilter = ClassFilter.TRUE;
	}

	if (methodAnnotationType != null) {
		this.methodMatcher = new AnnotationMethodMatcher(methodAnnotationType, checkInherited);
	}
	else {
		this.methodMatcher = MethodMatcher.TRUE;
	}
}
 
Example 4
Source File: AnnotationMatchingPointcut.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a new AnnotationMatchingPointcut for the given annotation type.
 * @param classAnnotationType the annotation type to look for at the class level
 * (can be {@code null})
 * @param methodAnnotationType the annotation type to look for at the method level
 * (can be {@code null})
 */
public AnnotationMatchingPointcut(
		Class<? extends Annotation> classAnnotationType, Class<? extends Annotation> methodAnnotationType) {

	Assert.isTrue((classAnnotationType != null || methodAnnotationType != null),
			"Either Class annotation type or Method annotation type needs to be specified (or both)");

	if (classAnnotationType != null) {
		this.classFilter = new AnnotationClassFilter(classAnnotationType);
	}
	else {
		this.classFilter = ClassFilter.TRUE;
	}

	if (methodAnnotationType != null) {
		this.methodMatcher = new AnnotationMethodMatcher(methodAnnotationType);
	}
	else {
		this.methodMatcher = MethodMatcher.TRUE;
	}
}
 
Example 5
Source File: MetaAnnotationMatchingPointcut.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
/**
 * Create a new MetaAnnotationMatchingPointcut for the given annotation type.
 *
 * @param classAnnotationType	the annotation type to look for at the class level
 *                             (can be <code>null</code>)
 * @param methodAnnotationType the annotation type to look for at the method level
 *                             (can be <code>null</code>)
 */
public MetaAnnotationMatchingPointcut(
		Class<? extends Annotation> classAnnotationType, Class<? extends Annotation> methodAnnotationType) {

	Assert.isTrue((classAnnotationType != null || methodAnnotationType != null),
			"Either Class annotation type or Method annotation type needs to be specified (or both)");

	if (classAnnotationType != null) {
		this.classFilter = new AnnotationClassFilter(classAnnotationType);
	} else {
		this.classFilter = ClassFilter.TRUE;
	}

	if (methodAnnotationType != null) {
		this.methodMatcher = new MetaAnnotationMethodMatcher(methodAnnotationType);
	} else {
		this.methodMatcher = MethodMatcher.TRUE;
	}
}
 
Example 6
Source File: MethodMatchers.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
public boolean equals(Object other) {
	if (this == other) {
		return true;
	}
	if (!super.equals(other)) {
		return false;
	}
	ClassFilter otherCf1 = ClassFilter.TRUE;
	ClassFilter otherCf2 = ClassFilter.TRUE;
	if (other instanceof ClassFilterAwareUnionMethodMatcher) {
		ClassFilterAwareUnionMethodMatcher cfa = (ClassFilterAwareUnionMethodMatcher) other;
		otherCf1 = cfa.cf1;
		otherCf2 = cfa.cf2;
	}
	return (this.cf1.equals(otherCf1) && this.cf2.equals(otherCf2));
}
 
Example 7
Source File: CglibProxyTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private ITestBean getAdvisedProxy(TestBean target) {
	ProxyFactory pf = new ProxyFactory(new Class<?>[]{ITestBean.class});
	pf.setProxyTargetClass(true);

	MethodInterceptor advice = new NopInterceptor();
	Pointcut pointcut = new Pointcut() {
		@Override
		public ClassFilter getClassFilter() {
			return ClassFilter.TRUE;
		}
		@Override
		public MethodMatcher getMethodMatcher() {
			return MethodMatcher.TRUE;
		}
		@Override
		public boolean equals(Object obj) {
			return true;
		}
		@Override
		public int hashCode() {
			return 0;
		}
	};
	pf.addAdvisor(new DefaultPointcutAdvisor(pointcut, advice));

	pf.setTarget(target);
	pf.setFrozen(true);
	pf.setExposeProxy(false);

	return (ITestBean) pf.getProxy();
}
 
Example 8
Source File: CglibProxyTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
private ITestBean getAdvisedProxy(TestBean target) {
	ProxyFactory pf = new ProxyFactory(new Class<?>[]{ITestBean.class});
	pf.setProxyTargetClass(true);

	MethodInterceptor advice = new NopInterceptor();
	Pointcut pointcut = new Pointcut() {
		@Override
		public ClassFilter getClassFilter() {
			return ClassFilter.TRUE;
		}
		@Override
		public MethodMatcher getMethodMatcher() {
			return MethodMatcher.TRUE;
		}
		@Override
		public boolean equals(Object obj) {
			return true;
		}
		@Override
		public int hashCode() {
			return 0;
		}
	};
	pf.addAdvisor(new DefaultPointcutAdvisor(pointcut, advice));

	pf.setTarget(target);
	pf.setFrozen(true);
	pf.setExposeProxy(false);

	return (ITestBean) pf.getProxy();
}
 
Example 9
Source File: ComposablePointcut.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Create a ComposablePointcut for the given MethodMatcher,
 * with {@code ClassFilter.TRUE}.
 * @param methodMatcher the MethodMatcher to use
 */
public ComposablePointcut(MethodMatcher methodMatcher) {
	Assert.notNull(methodMatcher, "MethodMatcher must not be null");
	this.classFilter = ClassFilter.TRUE;
	this.methodMatcher = methodMatcher;
}
 
Example 10
Source File: DynamicMethodMatcherPointcut.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public ClassFilter getClassFilter() {
	return ClassFilter.TRUE;
}
 
Example 11
Source File: ComposablePointcut.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a ComposablePointcut for the given MethodMatcher,
 * with {@code ClassFilter.TRUE}.
 * @param methodMatcher the MethodMatcher to use
 */
public ComposablePointcut(MethodMatcher methodMatcher) {
	Assert.notNull(methodMatcher, "MethodMatcher must not be null");
	this.classFilter = ClassFilter.TRUE;
	this.methodMatcher = methodMatcher;
}
 
Example 12
Source File: ComposablePointcut.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a default ComposablePointcut, with {@code ClassFilter.TRUE}
 * and {@code MethodMatcher.TRUE}.
 */
public ComposablePointcut() {
	this.classFilter = ClassFilter.TRUE;
	this.methodMatcher = MethodMatcher.TRUE;
}
 
Example 13
Source File: DynamicMethodMatcherPointcut.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ClassFilter getClassFilter() {
	return ClassFilter.TRUE;
}
 
Example 14
Source File: ProxyFactoryBeanTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public ClassFilter getClassFilter() {
	return ClassFilter.TRUE;
}
 
Example 15
Source File: ComposablePointcut.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Create a ComposablePointcut for the given MethodMatcher,
 * with {@code ClassFilter.TRUE}.
 * @param methodMatcher the MethodMatcher to use
 */
public ComposablePointcut(MethodMatcher methodMatcher) {
	Assert.notNull(methodMatcher, "MethodMatcher must not be null");
	this.classFilter = ClassFilter.TRUE;
	this.methodMatcher = methodMatcher;
}
 
Example 16
Source File: ComposablePointcut.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Create a default ComposablePointcut, with {@code ClassFilter.TRUE}
 * and {@code MethodMatcher.TRUE}.
 */
public ComposablePointcut() {
	this.classFilter = ClassFilter.TRUE;
	this.methodMatcher = MethodMatcher.TRUE;
}
 
Example 17
Source File: MonitoredWithAnnotationPointcut.java    From javamelody with Apache License 2.0 4 votes vote down vote up
/**
 * @return a class filter that lets all class through.
 */
@Override
public ClassFilter getClassFilter() {
	return ClassFilter.TRUE;
}
 
Example 18
Source File: ZebraRoutingPointcut.java    From Zebra with Apache License 2.0 4 votes vote down vote up
@Override
public ClassFilter getClassFilter() {
	return ClassFilter.TRUE;
}
 
Example 19
Source File: ProxyFactoryBeanTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public ClassFilter getClassFilter() {
	return ClassFilter.TRUE;
}
 
Example 20
Source File: MonitoredMeasuringPointcut.java    From javasimon with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Returns a class filter that lets all class through.
 *
 * @return a class filter that lets all class through
 */
@Override
public ClassFilter getClassFilter() {
	return ClassFilter.TRUE;
}