spin

Class Invocation


public class Invocation
extends java.lang.Object

A single invocation on a Spin proxy handled by Evaluators.

Constructor Summary

Invocation(Object object, Method method, Object[] args)
Create an invocation of the given method on the given object with the given arguments.

Method Summary

void
evaluate()
Evaluate the return value (or a possibly thrown Throwable) by invoking to method with the arguments on the wrapped object.
Object[]
getArguments()
Get the arguments for the invoked method.
Method
getMethod()
Get the invoked method.
Object
getObject()
Get the object this invocation is evaluated on.
Object
getResult()
Get the result of evaluation
Throwable
getThrowable()
Get the throwable thrown on evaluation.
boolean
isEvaluated()
Test if this invocation is already evaluated.
Object
resultOrThrow()
Get the result or throwable of this invocation's evaluation.
void
setArguments(Object[] args)
Set the arguments for the invoked method.
void
setMethod(Method method)
Set the method to invoke.
void
setObject(Object object)
Set the object this invocation is evaluated on.
void
setResult(Object result)
Set the result of evaluation
void
setThrowable(Throwable throwable)
Set the throwable thrown on evaluation.

Constructor Details

Invocation

public Invocation(Object object,
                  Method method,
                  Object[] args)
Create an invocation of the given method on the given object with the given arguments.
Parameters:
object - object to invoke method on
method - method to invoke
args - arguments for the method invocation

Method Details

evaluate

public void evaluate()
Evaluate the return value (or a possibly thrown Throwable) by invoking to method with the arguments on the wrapped object.

getArguments

public Object[] getArguments()
Get the arguments for the invoked method.
Returns:
the arguments for the invoked method

getMethod

public Method getMethod()
Get the invoked method.
Returns:
the invoked method

getObject

public Object getObject()
Get the object this invocation is evaluated on.
Returns:
the object this invocation is evaluated on

getResult

public Object getResult()
Get the result of evaluation
Returns:
the result

getThrowable

public Throwable getThrowable()
Get the throwable thrown on evaluation.
Returns:
the throwable

isEvaluated

public boolean isEvaluated()
Test if this invocation is already evaluated.
Returns:
true if evaluation has finished

resultOrThrow

public Object resultOrThrow()
            throws Throwable
Get the result or throwable of this invocation's evaluation.
Returns:
result result of evaluation

setArguments

public void setArguments(Object[] args)
Set the arguments for the invoked method.
Parameters:
args - the arguments for the invoked method

setMethod

public void setMethod(Method method)
Set the method to invoke.
Parameters:
method - method to invoke

setObject

public void setObject(Object object)
Set the object this invocation is evaluated on.
Parameters:
object - object to evaluate on

setResult

public void setResult(Object result)
Set the result of evaluation
Parameters:
result - the result

setThrowable

public void setThrowable(Throwable throwable)
Set the throwable thrown on evaluation.
Parameters:
throwable - the throwable