org.springframework.aop.framework
Class JdkDynamicAopProxy

java.lang.Object
  extended byorg.springframework.aop.framework.JdkDynamicAopProxy
All Implemented Interfaces:
AopProxy, java.lang.reflect.InvocationHandler, java.io.Serializable

final class JdkDynamicAopProxy
extends java.lang.Object
implements AopProxy, java.lang.reflect.InvocationHandler, java.io.Serializable

InvocationHandler implementation for the Spring AOP framework, based on J2SE 1.3+ dynamic proxies.

Creates a J2SE proxy, implementing the interfaces exposed by the proxy. Dynamic proxies cannot be used to proxy methods defined in classes, rather than interface.

Objects of this type should be obtained through proxy factories, configured by an AdvisedSupport class. This class is internal to the Spring framework and need not be used directly by client code.

Proxies created using this class will be threadsafe if the underlying (target) class is threadsafe.

Proxies are serializable so long as all Advisors are serializable (meaning both Advices and Pointcuts) and the TargetSource is serializable.

Author:
Rod Johnson, Juergen Hoeller
See Also:
Proxy, AdvisedSupport, ProxyFactory

Constructor Summary
protected JdkDynamicAopProxy(AdvisedSupport config)
          Construct a new JDK proxy.
 
Method Summary
 boolean equals(java.lang.Object other)
          Equality means interceptors and interfaces and TargetSource are equal.
 java.lang.Object getProxy()
          Create a new Proxy object for the given object, proxying the given interface.
 java.lang.Object getProxy(java.lang.ClassLoader cl)
          Create a new Proxy object for the given object, proxying the given interface.
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Implementation of InvocationHandler.invoke.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdkDynamicAopProxy

protected JdkDynamicAopProxy(AdvisedSupport config)
                      throws AopConfigException
Construct a new JDK proxy.

Throws:
AopConfigException - if the config is invalid. We try to throw an informative exception in this case, rather than let a mysterious failure happen later.
Method Detail

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Implementation of InvocationHandler.invoke. Callers will see exactly the exception thrown by the target, unless a hook method throws an exception.

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable

getProxy

public java.lang.Object getProxy()
Create a new Proxy object for the given object, proxying the given interface. Uses the thread context class loader.

Specified by:
getProxy in interface AopProxy

getProxy

public java.lang.Object getProxy(java.lang.ClassLoader cl)
Create a new Proxy object for the given object, proxying the given interface. Uses the given class loader.

Specified by:
getProxy in interface AopProxy

equals

public boolean equals(java.lang.Object other)
Equality means interceptors and interfaces and TargetSource are equal.

Parameters:
other - may be a dynamic proxy wrapping an instance of this class
See Also:
Object.equals(java.lang.Object)


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