Class ProxyFactory
- All Implemented Interfaces:
- Serializable,- Advised,- TargetClassAware
- Since:
- 14.03.2003
- Author:
- Rod Johnson, Juergen Hoeller, Rob Harrop
- See Also:
- 
Field SummaryFields inherited from class org.springframework.aop.framework.AdvisedSupportEMPTY_TARGET_SOURCE
- 
Constructor SummaryConstructorsConstructorDescriptionCreate 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 specifiedTargetSource, making the proxy implement the specified interface.ProxyFactory(Object target) Create a new ProxyFactory.
- 
Method SummaryModifier and TypeMethodDescriptiongetProxy()Create a new proxy according to the settings in this factory.getProxy(@Nullable ClassLoader classLoader) Create a new proxy according to the settings in this factory.static <T> TgetProxy(Class<T> proxyInterface, Interceptor interceptor) Create a new proxy for the given interface and interceptor.static <T> TgetProxy(Class<T> proxyInterface, TargetSource targetSource) Create a proxy for the specifiedTargetSource, implementing the specified interface.static ObjectgetProxy(TargetSource targetSource) Create a proxy for the specifiedTargetSourcethat extends the target class of theTargetSource.Class<?>getProxyClass(@Nullable ClassLoader classLoader) Determine the proxy class according to the settings in this factory.Methods inherited from class org.springframework.aop.framework.ProxyCreatorSupportaddListener, adviceChanged, createAopProxy, getAopProxyFactory, isActive, removeListener, setAopProxyFactoryMethods inherited from class org.springframework.aop.framework.AdvisedSupportaddAdvice, addAdvice, addAdvisor, addAdvisor, addAdvisors, addAdvisors, addInterface, adviceIncluded, copyConfigurationFrom, copyConfigurationFrom, countAdvicesOfType, getAdvisorChainFactory, getAdvisorCount, getAdvisors, getAdvisorsInternal, getInterceptorsAndDynamicInterceptionAdvice, getProxiedInterfaces, getTargetClass, getTargetSource, indexOf, indexOf, isInterfaceProxied, isPreFiltered, removeAdvice, removeAdvisor, removeAdvisor, removeInterface, replaceAdvisor, setAdvisorChainFactory, setInterfaces, setPreFiltered, setTarget, setTargetClass, setTargetSource, toProxyConfigString, toStringMethods inherited from class org.springframework.aop.framework.ProxyConfigcopyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClassMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.aop.framework.AdvisedisExposeProxy, isFrozen, isProxyTargetClass, setExposeProxy
- 
Constructor Details- 
ProxyFactorypublic ProxyFactory()Create a new ProxyFactory.
- 
ProxyFactoryCreate a new ProxyFactory.Will proxy all interfaces that the given target implements. - Parameters:
- target- the target object to be proxied
 
- 
ProxyFactoryCreate a new ProxyFactory.No target, only interfaces. Must add interceptors. - Parameters:
- proxyInterfaces- the interfaces that the proxy should implement
 
- 
ProxyFactoryCreate a new ProxyFactory for the given interface and 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. - Parameters:
- proxyInterface- the interface that the proxy should implement
- interceptor- the interceptor that the proxy should invoke
 
- 
ProxyFactoryCreate a ProxyFactory for the specifiedTargetSource, making the proxy implement the specified interface.- Parameters:
- proxyInterface- the interface that the proxy should implement
- targetSource- the TargetSource that the proxy should invoke
 
 
- 
- 
Method Details- 
getProxyCreate a new proxy according to the settings in this factory.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). - Returns:
- the proxy object
 
- 
getProxyCreate a new proxy according to the settings in this factory.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). - Parameters:
- classLoader- the class loader to create the proxy with (or- nullfor the low-level proxy facility's default)
- Returns:
- the proxy object
 
- 
getProxyClassDetermine the proxy class according to the settings in this factory.- Parameters:
- classLoader- the class loader to create the proxy class with (or- nullfor the low-level proxy facility's default)
- Returns:
- the proxy class
- Since:
- 6.0
 
- 
getProxyCreate a new proxy for the given interface and 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. - Parameters:
- proxyInterface- the interface that the proxy should implement
- interceptor- the interceptor that the proxy should invoke
- Returns:
- the proxy object
- See Also:
 
- 
getProxyCreate a proxy for the specifiedTargetSource, implementing the specified interface.- Parameters:
- proxyInterface- the interface that the proxy should implement
- targetSource- the TargetSource that the proxy should invoke
- Returns:
- the proxy object
- See Also:
 
- 
getProxyCreate a proxy for the specifiedTargetSourcethat extends the target class of theTargetSource.- Parameters:
- targetSource- the TargetSource that the proxy should invoke
- Returns:
- the proxy object
 
 
-