Class InvocationResult
- java.lang.Object
-
- com.tonic.analysis.execution.invoke.InvocationResult
-
public final class InvocationResult extends Object
Outcome of a method invocation attempt, pairing a status with the value, exception, or frame it produced.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInvocationResult.StatusOutcome category of an invocation attempt.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static InvocationResultcompleted(ConcreteValue value)Creates a result for a call that completed normally.static InvocationResultdelegated()Creates a result marking the call as handed off to an external executor.static InvocationResultexception(ObjectInstance ex)Creates a result for a call that raised a guest exception.ObjectInstancegetException()StackFramegetNewFrame()ConcreteValuegetReturnValue()InvocationResult.StatusgetStatus()booleanisCompleted()booleanisDelegated()booleanisException()booleanisNativeHandled()booleanisPushFrame()static InvocationResultnativeHandled(ConcreteValue value)Creates a result for a call satisfied by a native handler.static InvocationResultpushFrame(StackFrame frame)Creates a result instructing the interpreter to execute the given callee frame.StringtoString()
-
-
-
Method Detail
-
completed
public static InvocationResult completed(ConcreteValue value)
Creates a result for a call that completed normally.- Parameters:
value- the return value, or null for void- Returns:
- the completed result
-
pushFrame
public static InvocationResult pushFrame(StackFrame frame)
Creates a result instructing the interpreter to execute the given callee frame.- Parameters:
frame- the frame to push- Returns:
- the push-frame result
- Throws:
IllegalArgumentException- if frame is null
-
delegated
public static InvocationResult delegated()
Creates a result marking the call as handed off to an external executor.- Returns:
- the delegated result
-
nativeHandled
public static InvocationResult nativeHandled(ConcreteValue value)
Creates a result for a call satisfied by a native handler.- Parameters:
value- the handler's return value, or null for void- Returns:
- the native-handled result
-
exception
public static InvocationResult exception(ObjectInstance ex)
Creates a result for a call that raised a guest exception.- Parameters:
ex- the thrown guest exception instance- Returns:
- the exception result
- Throws:
IllegalArgumentException- if ex is null
-
getStatus
public InvocationResult.Status getStatus()
- Returns:
- the status
-
getReturnValue
public ConcreteValue getReturnValue()
- Returns:
- the return value
-
getException
public ObjectInstance getException()
- Returns:
- the exception
-
getNewFrame
public StackFrame getNewFrame()
- Returns:
- the new frame
-
isCompleted
public boolean isCompleted()
- Returns:
- true if the status is COMPLETED
-
isPushFrame
public boolean isPushFrame()
- Returns:
- true if the status is PUSH_FRAME
-
isDelegated
public boolean isDelegated()
- Returns:
- true if the status is DELEGATED
-
isNativeHandled
public boolean isNativeHandled()
- Returns:
- true if the status is NATIVE_HANDLED
-
isException
public boolean isException()
- Returns:
- true if the status is EXCEPTION
-
-