org.progeeks.util
Class AdapterInvocationHandler

java.lang.Object
  extended by org.progeeks.util.AdapterInvocationHandler
All Implemented Interfaces:
java.lang.reflect.InvocationHandler

public class AdapterInvocationHandler
extends java.lang.Object
implements java.lang.reflect.InvocationHandler

Adapts and interface or set of interfaces directly to another object that implements compatible methods. Basically, it's an easy way to make an object that conforms to an interface's methods actually implement that interface. In the future, it may also support mapping of similarly typed methods with different names, method names based on class, etc..

Version:
$Revision: 1.2 $
Author:
Paul Speed

Method Summary
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
static boolean isConformingClass(java.lang.Class[] interfaces, java.lang.Class objClass)
          Returns true if the specified class has method signatures that match the method signatures found in the interfaces specified.
static void main(java.lang.String[] args)
           
static java.lang.Object newAdapterProxy(java.lang.Class[] interfaces, java.lang.Object target)
          Creates a new dynamic proxy the implements the specified interfaces and passes the method calls directly through to the specified object.
static java.lang.Object newAdapterProxy(java.lang.ClassLoader loader, java.lang.Class[] interfaces, java.lang.Object target)
          Creates a new dynamic proxy the implements the specified interfaces and passes the method calls directly through to the specified object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newAdapterProxy

public static java.lang.Object newAdapterProxy(java.lang.Class[] interfaces,
                                               java.lang.Object target)
Creates a new dynamic proxy the implements the specified interfaces and passes the method calls directly through to the specified object.


newAdapterProxy

public static java.lang.Object newAdapterProxy(java.lang.ClassLoader loader,
                                               java.lang.Class[] interfaces,
                                               java.lang.Object target)
Creates a new dynamic proxy the implements the specified interfaces and passes the method calls directly through to the specified object.


isConformingClass

public static boolean isConformingClass(java.lang.Class[] interfaces,
                                        java.lang.Class objClass)
Returns true if the specified class has method signatures that match the method signatures found in the interfaces specified.


invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable

main

public static void main(java.lang.String[] args)


Copyright © 2002-2003 Paul Speed. All Rights Reserved.