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.

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.
<T> T
createProxy(Invoker invoker, Class<?>... types)
          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 <T> T createProxy(Invoker invoker,
                         Class<?>... types)
Description copied from interface: ProxyFactory
Create a new proxy instance.

Type Parameters:
T - The proxy's type.
Parameters:
invoker - the invocation handler.
types - the types the proxy must emulate.
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 examine.
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


Copyright © 2005-2010 Codehaus. All Rights Reserved.