public class InterceptorChain extends Object
InterceptorChain assists with creating proxies which go through a series of
interceptors.
MyServiceInterface serviceImpl = ...; ProxyFactory factory = ...; Interceptor[] interceptors = ...; InterceptorChain chain = new InterceptorChain(interceptors); ObjectProvider provider = chain.createProxyProvider(factory, serviceImpl); MyServiceInterface serviceProxy = ( MyServiceInterface )provider.getObject(); serviceProxy.someServiceMethod(...); // This will go through the interceptors!
| Constructor and Description |
|---|
InterceptorChain(Interceptor[] interceptors) |
| Modifier and Type | Method and Description |
|---|---|
ObjectProvider |
createProxyProvider(ProxyFactory proxyFactory,
ClassLoader classLoader,
Object terminus,
Class[] proxyClasses)
Creates an
ObjectProvider which will return a proxy that sends method invocations through this
chain of interceptors and ultimately arrive at the supplied terminus object. |
ObjectProvider |
createProxyProvider(ProxyFactory proxyFactory,
Object terminus)
Creates an
ObjectProvider which will return a proxy that sends method invocations through this
chain of interceptors and ultimately arrive at the supplied terminus object. |
ObjectProvider |
createProxyProvider(ProxyFactory proxyFactory,
Object terminus,
Class[] proxyClasses)
Creates an
ObjectProvider which will return a proxy that sends method invocations through this
chain of interceptors and ultimately arrive at the supplied terminus object. |
public InterceptorChain(Interceptor[] interceptors)
public ObjectProvider createProxyProvider(ProxyFactory proxyFactory, Object terminus)
ObjectProvider which will return a proxy that sends method invocations through this
chain of interceptors and ultimately arrive at the supplied terminus object. The proxy will support all
interfaces implemented by the terminus object. The thread context classloader will be used to generate the
proxy class.proxyFactory - the ProxyFactory to use to create the proxyterminus - the terminusObjectProvider which will return a proxy that sends method invocations through this
chain of interceptors and ultimately arrive at the supplied terminus objectpublic ObjectProvider createProxyProvider(ProxyFactory proxyFactory, Object terminus, Class[] proxyClasses)
ObjectProvider which will return a proxy that sends method invocations through this
chain of interceptors and ultimately arrive at the supplied terminus object. The proxy will support only
the specified interfaces/classes. The thread context classloader will be used to generate the
proxy class.proxyFactory - the ProxyFactory to use to create the proxyterminus - the terminusproxyClasses - the interfaces to supportObjectProvider which will return a proxy that sends method invocations through this
chain of interceptors and ultimately arrive at the supplied terminus objectpublic ObjectProvider createProxyProvider(ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus, Class[] proxyClasses)
ObjectProvider which will return a proxy that sends method invocations through this
chain of interceptors and ultimately arrive at the supplied terminus object. The proxy will support only
the specified interfaces/classes. The specified classloader will be used to generate the
proxy class.proxyFactory - the ProxyFactory to use to create the proxyclassLoader - the classloader to be used to generate the proxy classterminus - the terminusproxyClasses - the interfaces to supportObjectProvider which will return a proxy that sends method invocations through this
chain of interceptors and ultimately arrive at the supplied terminus objectCopyright © 2005-2013 Apache Software Foundation. All Rights Reserved.