|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.framework.ProxyConfig org.springframework.aop.framework.AdvisedSupport org.springframework.aop.framework.ProxyCreatorSupport org.springframework.aop.framework.ProxyFactory
public class ProxyFactory
Factory for AOP proxies for programmatic use, rather than via a bean factory. This class provides a simple way of obtaining and configuring AOP proxies in code.
Field Summary |
---|
Fields inherited from class org.springframework.aop.framework.AdvisedSupport |
---|
EMPTY_TARGET_SOURCE |
Constructor Summary | |
---|---|
ProxyFactory()
Create a new ProxyFactory. |
|
ProxyFactory(Class[] proxyInterfaces)
Create a new ProxyFactory. |
|
ProxyFactory(Class proxyInterface,
Interceptor interceptor)
Create a new ProxyFactory for the given interface and interceptor. |
|
ProxyFactory(Class proxyInterface,
TargetSource targetSource)
Create a ProxyFactory for the specified TargetSource ,
making the proxy implement the specified interface. |
|
ProxyFactory(Object target)
Create a new ProxyFactory. |
Method Summary | |
---|---|
Object |
getProxy()
Create a new proxy according to the settings in this factory. |
static Object |
getProxy(Class proxyInterface,
Interceptor interceptor)
Create a new proxy for the given interface and interceptor. |
Object |
getProxy(ClassLoader classLoader)
Create a new proxy according to the settings in this factory. |
static Object |
getProxy(Class proxyInterface,
TargetSource targetSource)
Create a proxy for the specified TargetSource ,
implementing the specified interface. |
static Object |
getProxy(TargetSource targetSource)
Create a proxy for the specified TargetSource that extends
the target class of the TargetSource . |
Methods inherited from class org.springframework.aop.framework.ProxyCreatorSupport |
---|
addListener, adviceChanged, createAopProxy, getAopProxyFactory, isActive, removeListener, setAopProxyFactory |
Methods inherited from class org.springframework.aop.framework.ProxyConfig |
---|
copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.aop.framework.Advised |
---|
isExposeProxy, isFrozen, isProxyTargetClass, setExposeProxy |
Constructor Detail |
---|
public ProxyFactory()
public ProxyFactory(Object target)
Will proxy all interfaces that the given target implements.
target
- the target object to be proxiedpublic ProxyFactory(Class[] proxyInterfaces)
No target, only interfaces. Must add interceptors.
proxyInterfaces
- the interfaces that the proxy should implementpublic ProxyFactory(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(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 invokeMethod Detail |
---|
public 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).
Thread.getContextClassLoader()
public Object getProxy(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 Object getProxy(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 invoke
ProxyFactory(Class, org.aopalliance.intercept.Interceptor)
public static Object getProxy(Class proxyInterface, TargetSource targetSource)
TargetSource
,
implementing the specified interface.
proxyInterface
- the interface that the proxy should implementtargetSource
- the TargetSource that the proxy should invoke
ProxyFactory(Class, org.springframework.aop.TargetSource)
public static Object getProxy(TargetSource targetSource)
TargetSource
that extends
the target class of the TargetSource
.
targetSource
- the TargetSource that the proxy should invoke
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |