sleep.engine
Class ProxyInterface

java.lang.Object
  extended by sleep.engine.ProxyInterface
All Implemented Interfaces:
InvocationHandler

public class ProxyInterface
extends Object
implements InvocationHandler

This class is used to mock an instance of a class that implements a specified Java interface using a Sleep function.


Field Summary
protected  Function func
           
protected  ScriptInstance script
           
 
Constructor Summary
ProxyInterface(Function _method, ScriptInstance _script)
           
 
Method Summary
static Object BuildInterface(Class[] classes, Block block, ScriptInstance script)
          Constructs a new instance of the specified class that uses the passed block to respond to all method calls on this instance.
static Object BuildInterface(Class[] classes, Function subroutine, ScriptInstance script)
          Constructs a new instance of the specified class that uses the passed Sleep function to respond to all method calls on this instance.
static Object BuildInterface(Class className, Block block, ScriptInstance script)
          Constructs a new instance of the specified class that uses the passed block to respond to all method calls on this instance.
static Object BuildInterface(Class className, Function subroutine, ScriptInstance script)
          Constructs a new instance of the specified class that uses the passed Sleep function to respond to all method calls on this instance.
 ScriptInstance getOwner()
          Returns the script associated with this proxy interface.
 Object invoke(Object proxy, Method method, Object[] args)
          This function invokes the contained Sleep closure with the specified arguments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

script

protected ScriptInstance script

func

protected Function func
Constructor Detail

ProxyInterface

public ProxyInterface(Function _method,
                      ScriptInstance _script)
Method Detail

getOwner

public ScriptInstance getOwner()
Returns the script associated with this proxy interface.


BuildInterface

public static Object BuildInterface(Class className,
                                    Function subroutine,
                                    ScriptInstance script)
Constructs a new instance of the specified class that uses the passed Sleep function to respond to all method calls on this instance.


BuildInterface

public static Object BuildInterface(Class[] classes,
                                    Function subroutine,
                                    ScriptInstance script)
Constructs a new instance of the specified class that uses the passed Sleep function to respond to all method calls on this instance.


BuildInterface

public static Object BuildInterface(Class className,
                                    Block block,
                                    ScriptInstance script)
Constructs a new instance of the specified class that uses the passed block to respond to all method calls on this instance.


BuildInterface

public static Object BuildInterface(Class[] classes,
                                    Block block,
                                    ScriptInstance script)
Constructs a new instance of the specified class that uses the passed block to respond to all method calls on this instance.


invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
This function invokes the contained Sleep closure with the specified arguments

Specified by:
invoke in interface InvocationHandler
Throws:
Throwable