Class ExecutionResult
java.lang.Object
com.pnfsoftware.jeb.util.interpreter.ExecutionResult
An object representing the result of execution of an action, including a type integer (return
code) and a message string.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intGeneric error result code.static final intNot-implemented operation result code.static final intUnsupported operation result code.static final intSuccess result code.static final ExecutionResultGeneric failed execution result.static final ExecutionResultGeneric successful execution result.static final ExecutionResultGeneric not-implemented execution result.static final ExecutionResultGeneric unsupported-operation execution result. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic ExecutionResultCreate an error execution result.static ExecutionResultCreate an error execution result from an exception.static ExecutionResultCreate an error execution result.static ExecutionResultfromBoolean(boolean success) Convert a boolean to a generic execution result.static ExecutionResultfromObject(Object object) Convert an object to an execution result.intgetCode()Get the result code.Get the result message.inthashCode()booleanisError()Determine whether execution failed.booleanDetermine whether execution succeeded.static ExecutionResultCreate a successful execution result.toString()
-
Field Details
-
CODE_SUCCESS
public static final int CODE_SUCCESSSuccess result code.- See Also:
-
CODE_ERROR
public static final int CODE_ERRORGeneric error result code.- See Also:
-
CODE_NOT_SUPPORTED
public static final int CODE_NOT_SUPPORTEDUnsupported operation result code.- See Also:
-
CODE_NOT_IMPLEMENTED
public static final int CODE_NOT_IMPLEMENTEDNot-implemented operation result code.- See Also:
-
GENERIC_SUCCESS
Generic successful execution result. -
GENERIC_ERROR
Generic failed execution result. -
NOT_SUPPORTED
Generic unsupported-operation execution result. -
NOT_IMPLEMENTED
Generic not-implemented execution result.
-
-
Method Details
-
success
Create a successful execution result.- Parameters:
msg- result message- Returns:
- a successful execution result
-
error
Create an error execution result.- Parameters:
msg- error message- Returns:
- an error execution result
-
error
Create an error execution result from an exception.- Parameters:
e- exception to convert- Returns:
- an error execution result
-
failure
Create an error execution result.- Parameters:
msg- error message- Returns:
- an error execution result
-
fromBoolean
Convert a boolean to a generic execution result.- Parameters:
success- true for success, false for error- Returns:
GENERIC_SUCCESSorGENERIC_ERROR
-
fromObject
Convert an object to an execution result.- Parameters:
object- object to convert- Returns:
- a successful result containing
object.toString(), orGENERIC_ERRORif the object is null
-
getCode
public int getCode()Get the result code.- Returns:
- result code
-
isSuccess
public boolean isSuccess()Determine whether execution succeeded.- Returns:
- true if the result code is
CODE_SUCCESS
-
isError
public boolean isError()Determine whether execution failed.- Returns:
- true if the result code is not
CODE_SUCCESS
-
getMessage
Get the result message.- Returns:
- result message, never null
-
hashCode
public int hashCode() -
equals
-
toString
-