public class ProxyFactory extends ProxyCreatorSupport
EMPTY_TARGET_SOURCE
Constructor and Description |
---|
ProxyFactory()
Create a new ProxyFactory.
|
ProxyFactory(java.lang.Class<?>... proxyInterfaces)
Create a new ProxyFactory.
|
ProxyFactory(java.lang.Class<?> proxyInterface,
Interceptor interceptor)
Create a new ProxyFactory for the given interface and interceptor.
|
ProxyFactory(java.lang.Class<?> proxyInterface,
TargetSource targetSource)
Create a ProxyFactory for the specified
TargetSource ,
making the proxy implement the specified interface. |
ProxyFactory(java.lang.Object target)
Create a new ProxyFactory.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getProxy()
Create a new proxy according to the settings in this factory.
|
static <T> T |
getProxy(java.lang.Class<T> proxyInterface,
Interceptor interceptor)
Create a new proxy for the given interface and interceptor.
|
static <T> T |
getProxy(java.lang.Class<T> proxyInterface,
TargetSource targetSource)
Create a proxy for the specified
TargetSource ,
implementing the specified interface. |
java.lang.Object |
getProxy(java.lang.ClassLoader classLoader)
Create a new proxy according to the settings in this factory.
|
static java.lang.Object |
getProxy(TargetSource targetSource)
Create a proxy for the specified
TargetSource that extends
the target class of the TargetSource . |
addListener, adviceChanged, createAopProxy, getAopProxyFactory, isActive, removeListener, setAopProxyFactory
addAdvice, addAdvice, addAdvisor, addAdvisor, addAdvisors, addAdvisors, addInterface, adviceIncluded, copyConfigurationFrom, copyConfigurationFrom, countAdvicesOfType, getAdvisorChainFactory, getAdvisors, getAdvisorsInternal, getInterceptorsAndDynamicInterceptionAdvice, getProxiedInterfaces, getTargetClass, getTargetSource, indexOf, indexOf, isInterfaceProxied, isPreFiltered, removeAdvice, removeAdvisor, removeAdvisor, removeInterface, replaceAdvisor, setAdvisorChainFactory, setInterfaces, setPreFiltered, setTarget, setTargetClass, setTargetSource, toProxyConfigString, toString, updateAdvisorArray
copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isExposeProxy, isFrozen, isProxyTargetClass, setExposeProxy
public ProxyFactory()
public ProxyFactory(java.lang.Object target)
Will proxy all interfaces that the given target implements.
target
- the target object to be proxiedpublic ProxyFactory(java.lang.Class<?>... proxyInterfaces)
No target, only interfaces. Must add interceptors.
proxyInterfaces
- the interfaces that the proxy should implementpublic ProxyFactory(java.lang.Class<?> proxyInterface, Interceptor interceptor)
Convenience method for creating a proxy for a single interceptor, assuming that the interceptor handles all calls itself rather than delegating to a target, like in the case of remoting proxies.
proxyInterface
- the interface that the proxy should implementinterceptor
- the interceptor that the proxy should invokepublic ProxyFactory(java.lang.Class<?> proxyInterface, TargetSource targetSource)
TargetSource
,
making the proxy implement the specified interface.proxyInterface
- the interface that the proxy should implementtargetSource
- the TargetSource that the proxy should invokepublic java.lang.Object getProxy()
Can be called repeatedly. Effect will vary if we've added or removed interfaces. Can add and remove interceptors.
Uses a default class loader: Usually, the thread context class loader (if necessary for proxy creation).
public java.lang.Object getProxy(@Nullable java.lang.ClassLoader classLoader)
Can be called repeatedly. Effect will vary if we've added or removed interfaces. Can add and remove interceptors.
Uses the given class loader (if necessary for proxy creation).
classLoader
- the class loader to create the proxy with
(or null
for the low-level proxy facility's default)public static <T> T getProxy(java.lang.Class<T> proxyInterface, Interceptor interceptor)
Convenience method for creating a proxy for a single interceptor, assuming that the interceptor handles all calls itself rather than delegating to a target, like in the case of remoting proxies.
proxyInterface
- the interface that the proxy should implementinterceptor
- the interceptor that the proxy should invokeProxyFactory(Class, org.aopalliance.intercept.Interceptor)
public static <T> T getProxy(java.lang.Class<T> proxyInterface, TargetSource targetSource)
TargetSource
,
implementing the specified interface.proxyInterface
- the interface that the proxy should implementtargetSource
- the TargetSource that the proxy should invokeProxyFactory(Class, org.springframework.aop.TargetSource)
public static java.lang.Object getProxy(TargetSource targetSource)
TargetSource
that extends
the target class of the TargetSource
.targetSource
- the TargetSource that the proxy should invoke