FutureResult functions
isSuccess(FutureResult<R,E> value)
- This function takes in a FutureResult value and returns a boolean indicating if the FutureResult is a success (This means that the
resultfield of the FutureResult is not null)
def FutureResult<string, string> yourFutureResult = new FutureResult<string, string>();
def boolean isSuccessful1 = isSuccess(yourFutureResult);
def boolean isSuccessful2 = yourFutureResult.isSuccess();
isFailure(FutureResult<R,E> value)
- This function takes in a FutureResult value and returns a boolean indicating if the FutureResult is a failure (This means that the
resultfield of the FutureResult is null)
def FutureResult<string, string> yourFutureResult = new FutureResult<string, string>();
def boolean isFailure1 = isFailure(yourFutureResult);
def boolean isFailure2 = yourFutureResult.isFailure();
getResult(FutureResult<R,E> value)
- This function takes in a FutureResult value and returns the
resultfield of the FutureResult
def FutureResult<string, string> yourFutureResult = new FutureResult<string, string>();
def string getResult1 = getResult(yourFutureResult);
def string getResult2 = yourFutureResult.getResult();
getError(FutureResult<R,E> value)
- This function takes in a FutureResult value and returns the
errorfield of the FutureResult
def FutureResult<string, string> yourFutureResult = new FutureResult<string, string>();
def string getError1 = getError(yourFutureResult);
def string getError2 = yourFutureResult.getError();
setResult(FutureResult<R,E> value, R result)
- This function takes in a FutureResult value and a result value to set the
resultfield of the FutureResult to the given result value. - Note that when you set the result, the error is set to null automatically
def FutureResult<string, string> yourFutureResult = new FutureResult<string, string>();
yourFutureResult.setResult("Success");
setResult(yourFutureResult, "Success");
setError(FutureResult<R,E> value, E error)
- This function takes in a FutureResult value and an error value and sets the
errorfield of the FutureResult to the given error value - Note that when you set the error, the result is set to null automatically
def FutureResult<string, string> yourFutureResult = new FutureResult<string, string>();
setError(yourFutureResult, "Error");
yourFutureResult.setError("Error");