Package sleep.engine
Class ProxyInterface
- java.lang.Object
-
- sleep.engine.ProxyInterface
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
public class ProxyInterface extends java.lang.Object implements java.lang.reflect.InvocationHandler
This class is used to mock an instance of a class that implements a specified Java interface using a Sleep function.
-
-
Field Summary
Fields Modifier and Type Field Description protected Function
func
protected ScriptInstance
script
-
Constructor Summary
Constructors Constructor Description ProxyInterface(Function _method, ScriptInstance _script)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
BuildInterface(java.lang.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 java.lang.Object
BuildInterface(java.lang.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 java.lang.Object
BuildInterface(java.lang.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 java.lang.Object
BuildInterface(java.lang.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.java.lang.Object
invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
This function invokes the contained Sleep closure with the specified argumentsjava.lang.String
toString()
Returns a string description of this proxy interface
-
-
-
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.
-
toString
public java.lang.String toString()
Returns a string description of this proxy interface- Overrides:
toString
in classjava.lang.Object
-
BuildInterface
public static java.lang.Object BuildInterface(java.lang.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 java.lang.Object BuildInterface(java.lang.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 java.lang.Object BuildInterface(java.lang.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 java.lang.Object BuildInterface(java.lang.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 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
This function invokes the contained Sleep closure with the specified arguments- Specified by:
invoke
in interfacejava.lang.reflect.InvocationHandler
- Throws:
java.lang.Throwable
-
-