Java源码示例:org.springframework.aop.support.ClassFilters

示例1
/**
 * Private constructor to share common code between impl-based delegate and reference-based delegate
 * (cannot use method such as init() to share common code, due the use of final fields)
 * @param interfaceType static field defining the introduction
 * @param typePattern type pattern the introduction is restricted to
 * @param implementationClass implementation class
 * @param advice delegation advice
 */
private DeclareParentsAdvisor(Class<?> interfaceType, String typePattern, Class<?> implementationClass, Advice advice) {
	this.introducedInterface = interfaceType;
	ClassFilter typePatternFilter = new TypePatternClassFilter(typePattern);

	// Excludes methods implemented.
	ClassFilter exclusion = new ClassFilter() {
		@Override
		public boolean matches(Class<?> clazz) {
			return !(introducedInterface.isAssignableFrom(clazz));
		}
	};

	this.typePatternClassFilter = ClassFilters.intersection(typePatternFilter, exclusion);
	this.advice = advice;
}
 
示例2
/**
 * Private constructor to share common code between impl-based delegate and reference-based delegate
 * (cannot use method such as init() to share common code, due the the use of final fields)
 * @param interfaceType static field defining the introduction
 * @param typePattern type pattern the introduction is restricted to
 * @param implementationClass implementation class
 * @param advice delegation advice
 */
private DeclareParentsAdvisor(Class<?> interfaceType, String typePattern, Class<?> implementationClass, Advice advice) {
	this.introducedInterface = interfaceType;
	ClassFilter typePatternFilter = new TypePatternClassFilter(typePattern);

	// Excludes methods implemented.
	ClassFilter exclusion = new ClassFilter() {
		@Override
		public boolean matches(Class<?> clazz) {
			return !(introducedInterface.isAssignableFrom(clazz));
		}
	};

	this.typePatternClassFilter = ClassFilters.intersection(typePatternFilter, exclusion);
	this.advice = advice;
}
 
示例3
/**
 * Private constructor to share common code between impl-based delegate and reference-based delegate
 * (cannot use method such as init() to share common code, due the use of final fields).
 * @param interfaceType static field defining the introduction
 * @param typePattern type pattern the introduction is restricted to
 * @param interceptor the delegation advice as {@link IntroductionInterceptor}
 */
private DeclareParentsAdvisor(Class<?> interfaceType, String typePattern, IntroductionInterceptor interceptor) {
	this.advice = interceptor;
	this.introducedInterface = interfaceType;

	// Excludes methods implemented.
	ClassFilter typePatternFilter = new TypePatternClassFilter(typePattern);
	ClassFilter exclusion = (clazz -> !this.introducedInterface.isAssignableFrom(clazz));
	this.typePatternClassFilter = ClassFilters.intersection(typePatternFilter, exclusion);
}
 
示例4
/**
 * Private constructor to share common code between impl-based delegate and reference-based delegate
 * (cannot use method such as init() to share common code, due the use of final fields).
 * @param interfaceType static field defining the introduction
 * @param typePattern type pattern the introduction is restricted to
 * @param interceptor the delegation advice as {@link IntroductionInterceptor}
 */
private DeclareParentsAdvisor(Class<?> interfaceType, String typePattern, IntroductionInterceptor interceptor) {
	this.advice = interceptor;
	this.introducedInterface = interfaceType;

	// Excludes methods implemented.
	ClassFilter typePatternFilter = new TypePatternClassFilter(typePattern);
	ClassFilter exclusion = (clazz -> !this.introducedInterface.isAssignableFrom(clazz));
	this.typePatternClassFilter = ClassFilters.intersection(typePatternFilter, exclusion);
}