org.springframework.aop.framework
Class ProxyFactory

org.springframework.aop.framework.ProxyConfig
  |
  +--org.springframework.aop.framework.AdvisedSupport
        |
        +--org.springframework.aop.framework.ProxyFactory

public class ProxyFactory
extends AdvisedSupport

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.

Author:
Rod Johnson
Version: $Id: ProxyFactory.java,v 1.10 2003/12/30 01:06:37 jhoeller Exp $
Since: 14-Mar-2003

Fields inherited from class org.springframework.aop.framework.AdvisedSupport
EMPTY_TARGET_SOURCE

Constructor Summary
ProxyFactory()
           
ProxyFactory(Object target)
          Proxy all interfaces of the given target.
ProxyFactory(Class[] interfaces)
          No target, only interfaces.

Method Summary
 ObjectgetProxy()
          Create new proxy according to the settings in this factory.
 static ObjectgetProxy(Class proxyInterface, Interceptor interceptor)
          Create new proxy for the given interface and interceptor.

Methods inherited from class org.springframework.aop.framework.AdvisedSupport
addAdvisor, addAdvisor, addAdvisor, addBeforeAdvice, addInterceptor, addInterceptor, addInterface, addListener, addThrowsAdvice, countInterceptorsOfType, getAdvisorChainFactory, getAdvisors, getMethodInvocationFactory, getProxiedInterfaces, getTargetSource, indexOf, indexOf, interceptorIncluded, isInterfaceProxied, removeAdvisor, removeAdvisor, removeInterceptor, removeInterface, removeListener, replaceAdvisor, setAdvisorChainFactory, setInterfaces, setMethodInvocationFactory, setTarget, setTargetSource, toProxyConfigString, toString

Methods inherited from class org.springframework.aop.framework.ProxyConfig
copyFrom, getExposeProxy, getOptimize, getProxyTargetClass, setExposeProxy, setOptimize, setProxyTargetClass

Constructor Detail

ProxyFactory

public ProxyFactory()

ProxyFactory

public ProxyFactory(Object target)
throws AopConfigException
Proxy all interfaces of the given target.

ProxyFactory

public ProxyFactory(Class[] interfaces)
No target, only interfaces. Must add interceptors.
Method Detail

getProxy

public Object getProxy()
Create 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"
Returns: Object

getProxy

public static Object getProxy(Class proxyInterface, Interceptor interceptor)
Create new proxy for the given interface and interceptor. Convenience method for creating a proxy for a single interceptor.
Parameters:
proxyInterface - the interface that the proxy should implement
interceptor - the interceptor that the proxy should invoke
Returns: the new proxy