Holger's
Java API

com.antelmann.util
Class InterfaceWrapper

java.lang.Object
  extended by com.antelmann.util.InterfaceWrapper

public class InterfaceWrapper
extends Object

provides methods to generate special proxy objects that observe calls to specified interfaces

Since:
06/21/06
Author:
Holger Antelmann
See Also:
InterfaceMonitor, Proxy

Method Summary
static Object wrapObject(ClassLoader cl, Object object, InterfaceMonitor monitor, Class<?>... interfacesToObserve)
          returns an object that - apart from implementing the given interfaces - monitors each call to the object through the interfaces.
static Object wrapObject(Object obj, InterfaceMonitor mon, Class<?>... interfacesToObserve)
          uses the ClassLoader from Settings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

wrapObject

public static Object wrapObject(Object obj,
                                InterfaceMonitor mon,
                                Class<?>... interfacesToObserve)
                         throws IllegalArgumentException
uses the ClassLoader from Settings

Throws:
IllegalArgumentException
See Also:
Settings.getClassLoader(), wrapObject(ClassLoader, Object, InterfaceMonitor, Class...)

wrapObject

public static Object wrapObject(ClassLoader cl,
                                Object object,
                                InterfaceMonitor monitor,
                                Class<?>... interfacesToObserve)
                         throws IllegalArgumentException
returns an object that - apart from implementing the given interfaces - monitors each call to the object through the interfaces. The given object must implement all interfaces that are to be observed. The return value can then savely be casted to one of the given interfaces.

Returns:
a proxy object that monitors all calls to the given interface through the given monitor. The returned proxy can savely be casted to any of the given interfaces to be observed.
Throws:
IllegalArgumentException


(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads