Java Code Examples for org.springframework.aop.support.DelegatingIntroductionInterceptor#suppressInterface()

The following examples show how to use org.springframework.aop.support.DelegatingIntroductionInterceptor#suppressInterface() . 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: ScriptFactoryPostProcessor.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a refreshable proxy for the given AOP TargetSource.
 * @param ts the refreshable TargetSource
 * @param interfaces the proxy interfaces (may be {@code null} to
 * indicate proxying of all interfaces implemented by the target class)
 * @return the generated proxy
 * @see RefreshableScriptTargetSource
 */
protected Object createRefreshableProxy(TargetSource ts, Class<?>[] interfaces, boolean proxyTargetClass) {
	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setTargetSource(ts);
	ClassLoader classLoader = this.beanClassLoader;

	if (interfaces == null) {
		interfaces = ClassUtils.getAllInterfacesForClass(ts.getTargetClass(), this.beanClassLoader);
	}
	proxyFactory.setInterfaces(interfaces);
	if (proxyTargetClass) {
		classLoader = null;  // force use of Class.getClassLoader()
		proxyFactory.setProxyTargetClass(true);
	}

	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
	introduction.suppressInterface(TargetSource.class);
	proxyFactory.addAdvice(introduction);

	return proxyFactory.getProxy(classLoader);
}
 
Example 2
Source File: ScriptFactoryPostProcessor.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Create a refreshable proxy for the given AOP TargetSource.
 * @param ts the refreshable TargetSource
 * @param interfaces the proxy interfaces (may be {@code null} to
 * indicate proxying of all interfaces implemented by the target class)
 * @return the generated proxy
 * @see RefreshableScriptTargetSource
 */
protected Object createRefreshableProxy(TargetSource ts, Class<?>[] interfaces, boolean proxyTargetClass) {
	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setTargetSource(ts);
	ClassLoader classLoader = this.beanClassLoader;

	if (interfaces == null) {
		interfaces = ClassUtils.getAllInterfacesForClass(ts.getTargetClass(), this.beanClassLoader);
	}
	proxyFactory.setInterfaces(interfaces);
	if (proxyTargetClass) {
		classLoader = null;  // force use of Class.getClassLoader()
		proxyFactory.setProxyTargetClass(true);
	}

	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
	introduction.suppressInterface(TargetSource.class);
	proxyFactory.addAdvice(introduction);

	return proxyFactory.getProxy(classLoader);
}
 
Example 3
Source File: ScriptFactoryPostProcessor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Create a refreshable proxy for the given AOP TargetSource.
 * @param ts the refreshable TargetSource
 * @param interfaces the proxy interfaces (may be {@code null} to
 * indicate proxying of all interfaces implemented by the target class)
 * @return the generated proxy
 * @see RefreshableScriptTargetSource
 */
protected Object createRefreshableProxy(TargetSource ts, @Nullable Class<?>[] interfaces, boolean proxyTargetClass) {
	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setTargetSource(ts);
	ClassLoader classLoader = this.beanClassLoader;

	if (interfaces != null) {
		proxyFactory.setInterfaces(interfaces);
	}
	else {
		Class<?> targetClass = ts.getTargetClass();
		if (targetClass != null) {
			proxyFactory.setInterfaces(ClassUtils.getAllInterfacesForClass(targetClass, this.beanClassLoader));
		}
	}

	if (proxyTargetClass) {
		classLoader = null;  // force use of Class.getClassLoader()
		proxyFactory.setProxyTargetClass(true);
	}

	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
	introduction.suppressInterface(TargetSource.class);
	proxyFactory.addAdvice(introduction);

	return proxyFactory.getProxy(classLoader);
}
 
Example 4
Source File: GenericMessageEndpointFactory.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Wrap each concrete endpoint instance with an AOP proxy,
 * exposing the message listener's interfaces as well as the
 * endpoint SPI through an AOP introduction.
 */
@Override
public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
	GenericMessageEndpoint endpoint = (GenericMessageEndpoint) super.createEndpoint(xaResource);
	ProxyFactory proxyFactory = new ProxyFactory(getMessageListener());
	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(endpoint);
	introduction.suppressInterface(MethodInterceptor.class);
	proxyFactory.addAdvice(introduction);
	return (MessageEndpoint) proxyFactory.getProxy();
}
 
Example 5
Source File: ScriptFactoryPostProcessor.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Create a refreshable proxy for the given AOP TargetSource.
 * @param ts the refreshable TargetSource
 * @param interfaces the proxy interfaces (may be {@code null} to
 * indicate proxying of all interfaces implemented by the target class)
 * @return the generated proxy
 * @see RefreshableScriptTargetSource
 */
protected Object createRefreshableProxy(TargetSource ts, @Nullable Class<?>[] interfaces, boolean proxyTargetClass) {
	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setTargetSource(ts);
	ClassLoader classLoader = this.beanClassLoader;

	if (interfaces != null) {
		proxyFactory.setInterfaces(interfaces);
	}
	else {
		Class<?> targetClass = ts.getTargetClass();
		if (targetClass != null) {
			proxyFactory.setInterfaces(ClassUtils.getAllInterfacesForClass(targetClass, this.beanClassLoader));
		}
	}

	if (proxyTargetClass) {
		classLoader = null;  // force use of Class.getClassLoader()
		proxyFactory.setProxyTargetClass(true);
	}

	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
	introduction.suppressInterface(TargetSource.class);
	proxyFactory.addAdvice(introduction);

	return proxyFactory.getProxy(classLoader);
}
 
Example 6
Source File: GenericMessageEndpointFactory.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Wrap each concrete endpoint instance with an AOP proxy,
 * exposing the message listener's interfaces as well as the
 * endpoint SPI through an AOP introduction.
 */
@Override
public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
	GenericMessageEndpoint endpoint = (GenericMessageEndpoint) super.createEndpoint(xaResource);
	ProxyFactory proxyFactory = new ProxyFactory(getMessageListener());
	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(endpoint);
	introduction.suppressInterface(MethodInterceptor.class);
	proxyFactory.addAdvice(introduction);
	return (MessageEndpoint) proxyFactory.getProxy();
}
 
Example 7
Source File: GenericMessageEndpointFactory.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Wrap each concrete endpoint instance with an AOP proxy,
 * exposing the message listener's interfaces as well as the
 * endpoint SPI through an AOP introduction.
 */
@Override
public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
	GenericMessageEndpoint endpoint = (GenericMessageEndpoint) super.createEndpoint(xaResource);
	ProxyFactory proxyFactory = new ProxyFactory(this.messageListener);
	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(endpoint);
	introduction.suppressInterface(MethodInterceptor.class);
	proxyFactory.addAdvice(introduction);
	return (MessageEndpoint) proxyFactory.getProxy();
}
 
Example 8
Source File: GenericMessageEndpointFactory.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Wrap each concrete endpoint instance with an AOP proxy,
 * exposing the message listener's interfaces as well as the
 * endpoint SPI through an AOP introduction.
 */
@Override
public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
	GenericMessageEndpoint endpoint = (GenericMessageEndpoint) super.createEndpoint(xaResource);
	ProxyFactory proxyFactory = new ProxyFactory(this.messageListener);
	DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(endpoint);
	introduction.suppressInterface(MethodInterceptor.class);
	proxyFactory.addAdvice(introduction);
	return (MessageEndpoint) proxyFactory.getProxy();
}