com.thoughtworks.proxy.factory
Class StandardProxyFactory

java.lang.Object
  extended by com.thoughtworks.proxy.factory.StandardProxyFactory
All Implemented Interfaces:
ProxyFactory, Serializable

public class StandardProxyFactory
extends Object

A ProxyFactory based on a JDK greater or equal 1.3.

Since:
0.1
Author:
Aslak Hellesøy
See Also:
com.thoughtworks.proxy.factory, Serialized Form

Field Summary
static Method getInvoker
          The getInvoker method.
 
Constructor Summary
StandardProxyFactory()
           
 
Method Summary
 boolean canProxy(Class type)
          Test if the ProxyFactory implementation is capable of creating a proxy instance for the given type.
 Object createProxy(Class[] types, Invoker invoker)
          Create a new proxy instance.
 Invoker getInvoker(Object proxy)
          Retrieve the invocation handler of the proxy.
 boolean isProxyClass(Class type)
          Test if the given type is a proxy class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

getInvoker

public static final Method getInvoker
The getInvoker method.

Constructor Detail

StandardProxyFactory

public StandardProxyFactory()
Method Detail

createProxy

public Object createProxy(Class[] types,
                          Invoker invoker)
Description copied from interface: ProxyFactory
Create a new proxy instance.

Parameters:
types - the types the proxy must emulate.
invoker - the invocation handler.
Returns:
the new proxy instance.

canProxy

public boolean canProxy(Class type)
Description copied from interface: ProxyFactory
Test if the ProxyFactory implementation is capable of creating a proxy instance for the given type.

Parameters:
type - the type to create a proxy instance for.
Returns:
true if the type is supported.

isProxyClass

public boolean isProxyClass(Class type)
Description copied from interface: ProxyFactory
Test if the given type is a proxy class.

Parameters:
type - the type to examin.
Returns:
true if the given type is a proxy class.

getInvoker

public Invoker getInvoker(Object proxy)
Retrieve the invocation handler of the proxy. The implementation of this method relies on the implementation of the derived factory to add the interface InvokerReference to every proxy instance.

Specified by:
getInvoker in interface ProxyFactory
Parameters:
proxy - the proxy instance.
Returns:
the Invoker instance acting as invocation handler.
Since:
0.1