org.springframework.aop.framework
Class ProxyFactory

java.lang.Object
  extended byorg.springframework.aop.framework.ProxyConfig
      extended byorg.springframework.aop.framework.AdvisedSupport
          extended byorg.springframework.aop.framework.ProxyFactory
All Implemented Interfaces:
Advised

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.

Since:
14-Mar-2003
Version:
$Id: ProxyFactory.java,v 1.11 2004/03/18 02:46:05 trisberg Exp $
Author:
Rod Johnson

Field Summary
 
Fields inherited from class org.springframework.aop.framework.AdvisedSupport
advisorChainFactory, EMPTY_TARGET_SOURCE, targetSource
 
Fields inherited from class org.springframework.aop.framework.ProxyConfig
exposeProxy, logger
 
Constructor Summary
ProxyFactory()
           
ProxyFactory(java.lang.Class[] interfaces)
          No target, only interfaces.
ProxyFactory(java.lang.Object target)
          Proxy all interfaces of the given target.
 
Method Summary
 java.lang.Object getProxy()
          Create new proxy according to the settings in this factory.
static java.lang.Object getProxy(java.lang.Class proxyInterface, org.aopalliance.intercept.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, copyConfigurationFrom, countInterceptorsOfType, createAopProxy, getAdvisorChainFactory, getAdvisors, getMethodInvocationFactory, getProxiedInterfaces, getTargetSource, indexOf, indexOf, interceptorIncluded, isActive, isInterfaceProxied, removeAdvisor, removeAdvisor, removeInterceptor, removeInterface, removeListener, replaceAdvisor, setAdvisorChainFactory, setInterfaces, setMethodInvocationFactory, setTarget, setTargetSource, toProxyConfigString, toString
 
Methods inherited from class org.springframework.aop.framework.ProxyConfig
copyFrom, getAopProxyFactory, getExposeProxy, getOptimize, getProxyTargetClass, isFrozen, setAopProxyFactory, setExposeProxy, setFrozen, 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
getExposeProxy, getProxyTargetClass, isFrozen
 

Constructor Detail

ProxyFactory

public ProxyFactory()

ProxyFactory

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


ProxyFactory

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

Method Detail

getProxy

public java.lang.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 java.lang.Object getProxy(java.lang.Class proxyInterface,
                                        org.aopalliance.intercept.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


Copyright (C) 2003-2004 The Spring Framework Project.