public class BlockRunner
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.function.Function<BlockRunner,BaseDataType> |
block
Main code block to execute.
|
boolean |
error
true if an error condition is raised in the code execution. |
java.lang.String |
errorMessage
Error message of the error condition that was raised in the code execution.
|
int |
errorNumber
Error number of the error condition that was raised in the code execution.
|
private java.lang.Runnable |
post
Post-processing block (optional).
|
boolean |
quit
true if a quit condition is raised in the code execution. |
BaseDataType |
result
Return value from the code block execution.
|
private boolean |
silent
Flag to determine if the code is run in silent error mode or not.
|
boolean |
stop
true if a stop condition is raised in the code execution. |
Constructor and Description |
---|
BlockRunner(java.util.function.Function<BlockRunner,BaseDataType> block)
Create an instance to execute the given code block(s) WITHOUT silent mode.
|
BlockRunner(java.util.function.Function<BlockRunner,BaseDataType> block,
java.lang.Runnable post,
boolean silent)
Create an instance to execute the given code block(s).
|
Modifier and Type | Method and Description |
---|---|
void |
execute()
Run the code block.
|
private void |
process()
Execute the code block with integrated error management.
|
public BaseDataType result
public boolean error
true
if an error condition is raised in the code execution.public boolean stop
true
if a stop condition is raised in the code execution.public boolean quit
true
if a quit condition is raised in the code execution.public int errorNumber
public java.lang.String errorMessage
private java.util.function.Function<BlockRunner,BaseDataType> block
private java.lang.Runnable post
private boolean silent
public BlockRunner(java.util.function.Function<BlockRunner,BaseDataType> block)
block
- The main code block to execute. Must NOT be null
.public BlockRunner(java.util.function.Function<BlockRunner,BaseDataType> block, java.lang.Runnable post, boolean silent)
block
- The main code block to execute. Must NOT be null
.post
- Optional block to execute as post-processing. It will happen in a finally block
if this is non-null.silent
- true
if this should be executed in silent error mode.