org.springframework.aop.IntroductionInterceptor Java Examples

The following examples show how to use org.springframework.aop.IntroductionInterceptor. 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: DeclareParentsAdvisor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #2
Source File: DelegatePerTargetObjectIntroductionInterceptor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
public DelegatePerTargetObjectIntroductionInterceptor(Class<?> defaultImplType, Class<?> interfaceType) {
	this.defaultImplType = defaultImplType;
	this.interfaceType = interfaceType;
	// Create a new delegate now (but don't store it in the map).
	// We do this for two reasons:
	// 1) to fail early if there is a problem instantiating delegates
	// 2) to populate the interface map once and once only
	Object delegate = createNewDelegate();
	implementInterfacesOnObject(delegate);
	suppressInterface(IntroductionInterceptor.class);
	suppressInterface(DynamicIntroductionAdvice.class);
}
 
Example #3
Source File: DelegatingIntroductionInterceptor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Both constructors use this init method, as it is impossible to pass
 * a "this" reference from one constructor to another.
 * @param delegate the delegate object
 */
private void init(Object delegate) {
	Assert.notNull(delegate, "Delegate must not be null");
	this.delegate = delegate;
	implementInterfacesOnObject(delegate);

	// We don't want to expose the control interface
	suppressInterface(IntroductionInterceptor.class);
	suppressInterface(DynamicIntroductionAdvice.class);
}
 
Example #4
Source File: DeclareParentsAdvisor.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #5
Source File: DelegatePerTargetObjectIntroductionInterceptor.java    From java-technology-stack with MIT License 5 votes vote down vote up
public DelegatePerTargetObjectIntroductionInterceptor(Class<?> defaultImplType, Class<?> interfaceType) {
	this.defaultImplType = defaultImplType;
	this.interfaceType = interfaceType;
	// Create a new delegate now (but don't store it in the map).
	// We do this for two reasons:
	// 1) to fail early if there is a problem instantiating delegates
	// 2) to populate the interface map once and once only
	Object delegate = createNewDelegate();
	implementInterfacesOnObject(delegate);
	suppressInterface(IntroductionInterceptor.class);
	suppressInterface(DynamicIntroductionAdvice.class);
}
 
Example #6
Source File: DelegatingIntroductionInterceptor.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Both constructors use this init method, as it is impossible to pass
 * a "this" reference from one constructor to another.
 * @param delegate the delegate object
 */
private void init(Object delegate) {
	Assert.notNull(delegate, "Delegate must not be null");
	this.delegate = delegate;
	implementInterfacesOnObject(delegate);

	// We don't want to expose the control interface
	suppressInterface(IntroductionInterceptor.class);
	suppressInterface(DynamicIntroductionAdvice.class);
}
 
Example #7
Source File: DelegatePerTargetObjectIntroductionInterceptor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public DelegatePerTargetObjectIntroductionInterceptor(Class<?> defaultImplType, Class<?> interfaceType) {
	this.defaultImplType = defaultImplType;
	this.interfaceType = interfaceType;
	// Create a new delegate now (but don't store it in the map).
	// We do this for two reasons:
	// 1) to fail early if there is a problem instantiating delegates
	// 2) to populate the interface map once and once only
	Object delegate = createNewDelegate();
	implementInterfacesOnObject(delegate);
	suppressInterface(IntroductionInterceptor.class);
	suppressInterface(DynamicIntroductionAdvice.class);
}
 
Example #8
Source File: DelegatingIntroductionInterceptor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Both constructors use this init method, as it is impossible to pass
 * a "this" reference from one constructor to another.
 * @param delegate the delegate object
 */
private void init(Object delegate) {
	Assert.notNull(delegate, "Delegate must not be null");
	this.delegate = delegate;
	implementInterfacesOnObject(delegate);

	// We don't want to expose the control interface
	suppressInterface(IntroductionInterceptor.class);
	suppressInterface(DynamicIntroductionAdvice.class);
}
 
Example #9
Source File: DelegatePerTargetObjectIntroductionInterceptor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
public DelegatePerTargetObjectIntroductionInterceptor(Class<?> defaultImplType, Class<?> interfaceType) {
	this.defaultImplType = defaultImplType;
	this.interfaceType = interfaceType;
	// Create a new delegate now (but don't store it in the map).
	// We do this for two reasons:
	// 1) to fail early if there is a problem instantiating delegates
	// 2) to populate the interface map once and once only
	Object delegate = createNewDelegate();
	implementInterfacesOnObject(delegate);
	suppressInterface(IntroductionInterceptor.class);
	suppressInterface(DynamicIntroductionAdvice.class);
}
 
Example #10
Source File: DelegatingIntroductionInterceptor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Both constructors use this init method, as it is impossible to pass
 * a "this" reference from one constructor to another.
 * @param delegate the delegate object
 */
private void init(Object delegate) {
	Assert.notNull(delegate, "Delegate must not be null");
	this.delegate = delegate;
	implementInterfacesOnObject(delegate);

	// We don't want to expose the control interface
	suppressInterface(IntroductionInterceptor.class);
	suppressInterface(DynamicIntroductionAdvice.class);
}