org.joe_e.reflect
Class Proxies

java.lang.Object
  extended by org.joe_e.reflect.Proxies

public final class Proxies
extends Object

The dynamic proxy interface. This is a wrapper around Java's dynamic proxy features provided by java.lang.reflect.Proxy.


Method Summary
static InvocationHandler getHandler(Proxy proxy)
          Extract the InvocationHandler from a Proxy
static boolean isImplementable(Class<?> type)
          Returns true if the argument is an interface that can be implemented by a Proxy using proxy().
static Object proxy(InvocationHandler handler, Class<?>... interfaces)
          Constructs a dynamic proxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getHandler

public static InvocationHandler getHandler(Proxy proxy)
Extract the InvocationHandler from a Proxy

Parameters:
proxy - proxy instance
Returns:
the invocation handler for the proxy

proxy

public static Object proxy(InvocationHandler handler,
                           Class<?>... interfaces)
                    throws ClassCastException
Constructs a dynamic proxy.

Parameters:
handler - invocation handler
interfaces - each implemented interface
Returns:
dynamic proxy
Throws:
ClassCastException - a restriction on the types is violated
NullPointerException - an argument is null

isImplementable

public static boolean isImplementable(Class<?> type)
Returns true if the argument is an interface that can be implemented by a Proxy using proxy().

Parameters:
type - candidate interface
Returns:
true if a Joe-E type, else false