|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.clazzes.util.aop.ProxyFactory
public class ProxyFactory
A lightweight proxy factory for instantiating intercepted instances of interface implementations.
If you need special sets of interceptors and multiple implementing interfaces, use
getProxy()
for creating proxies.
For most cases it is sufficient to use getTypedProxy(Object, Class)
,
which allows you to use a singleton ProxyFactory
for generating multiple proxies.
Constructor Summary | |
---|---|
ProxyFactory()
|
Method Summary | ||
---|---|---|
ClassLoader |
getClassLoader()
|
|
Pattern |
getExcludeMethods()
|
|
Pattern |
getIncludeMethods()
|
|
org.aopalliance.intercept.MethodInterceptor[] |
getInterceptors()
|
|
Class[] |
getInterfaces()
|
|
Object |
getMultiTypedProxy(Object _target,
Class[] ifaces)
This method facilitates the use of a proxy singleton to generate more proxies for different targets with a changing set of interfaces but with the same set of interceptors. |
|
Object |
getProxy()
|
|
Object |
getTarget()
|
|
|
getTypedProxy(Object _target,
Class<T> iface)
This method facilitates the use of a proxy singleton to generate more proxies for different targets with changing interfaces but with the same set of interceptors. |
|
void |
setClassLoader(ClassLoader classLoader)
|
|
void |
setExcludeMethods(Pattern excludeMethods)
|
|
void |
setIncludeMethods(Pattern includeMethods)
|
|
void |
setInterceptor(org.aopalliance.intercept.MethodInterceptor interceptor)
Convenience setter, which sets the invoked interceptors to a single instance. |
|
void |
setInterceptors(org.aopalliance.intercept.MethodInterceptor[] interceptors)
|
|
void |
setInterface(Class iface)
Convenience setter, which sets the proxy-implemented interfaces to a single interface. |
|
void |
setInterfaces(Class[] interfaces)
|
|
void |
setTarget(Object target)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProxyFactory()
Method Detail |
---|
public <T> T getTypedProxy(Object _target, Class<T> iface)
This method facilitates the use of a proxy singleton to generate more proxies for
different targets with changing interfaces but with the same set of interceptors.
If your interceptors are different
for each target, use separate ProxyFactory
instances with different bean
configurations.
This method ignores the target
and interfaces
bean properties.
_target
- The target to wrap.iface
- The interface of the returned proxy.
public Object getProxy()
public Object getMultiTypedProxy(Object _target, Class[] ifaces)
This method facilitates the use of a proxy singleton to generate more proxies for
different targets with a changing set of interfaces but with the same set of interceptors.
If your interceptors are different
for each target, use separate ProxyFactory
instances with different bean
configurations.
This method ignores the target
and interfaces
bean properties.
_target
- The target to wrap.ifaces
- The list of interface to be implemented by the returned proxy.
public Object getTarget()
public void setTarget(Object target)
target
- the target to set. There's no need to call this method, if
you use getTypedProxy(Object, Class)
.public ClassLoader getClassLoader()
null
, the class loader of
the target object should be used.public void setClassLoader(ClassLoader classLoader)
classLoader
- the classLoader to setpublic Class[] getInterfaces()
public void setInterfaces(Class[] interfaces)
interfaces
- the interfaces, which are implemented by the generated proxy to set.
There's no need to call this method, if you use getTypedProxy(Object, Class)
.public void setInterface(Class iface)
getTypedProxy(Object, Class)
.
iface
- the interface to setpublic org.aopalliance.intercept.MethodInterceptor[] getInterceptors()
public void setInterceptors(org.aopalliance.intercept.MethodInterceptor[] interceptors)
interceptors
- the interceptors to setpublic void setInterceptor(org.aopalliance.intercept.MethodInterceptor interceptor)
interceptor
- the interceptor to setpublic Pattern getIncludeMethods()
null
, all interface methods are included.public void setIncludeMethods(Pattern includeMethods)
includeMethods
- the includeMethods to setpublic Pattern getExcludeMethods()
null
, no interface method is omitted.public void setExcludeMethods(Pattern excludeMethods)
excludeMethods
- the excludeMethods to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |