org.oddjob.framework
Class ProxyGenerator<T>

java.lang.Object
  extended by org.oddjob.framework.ProxyGenerator<T>
Type Parameters:
T - The type of the component being wrapped.
Direct Known Subclasses:
CallableProxyGenerator, CollectionProxyGenerator, RunnableProxyGenerator, ServiceProxyGenerator

public class ProxyGenerator<T>
extends Object

Generates a Proxy for a wrapped component. The proxy provided will implement all interfaces from the original component as well as those provided by the WrapperFactory.

If the wrapped component is an instance of an ComponentAdapter the underlying component interface will be used instead.

Author:
rob

Constructor Summary
ProxyGenerator()
           
 
Method Summary
 Object generate(T wrapped, WrapperFactory<T> wrapperFactory, ClassLoader classLoader)
          Generate the proxy.
static Class<?>[] interfacesFor(Object object)
          Find all the interfaces an object implements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyGenerator

public ProxyGenerator()
Method Detail

generate

public Object generate(T wrapped,
                       WrapperFactory<T> wrapperFactory,
                       ClassLoader classLoader)
Generate the proxy.

Parameters:
wrapped - The component being wrapped.
wrapperFactory -
classLoader -
Returns:
A proxy implementing all the interface of factory and component.

interfacesFor

public static Class<?>[] interfacesFor(Object object)
Find all the interfaces an object implements.

Parameters:
object - The object.
Returns:
All the interfaces it implements