Class AbstractResult<V>
java.lang.Object
org.springframework.vault.support.AbstractResult<V>
- Direct Known Subclasses:
VaultDecryptionResult,VaultEncryptionResult,VaultTransformDecodeResult,VaultTransformEncodeResult
Supporting class for computation results allowing introspection of the result value.
Accessing the result with
get() returns either the result or throws a
VaultException if the execution completed with an error.- Since:
- 1.1
- Author:
- Mark Paluch
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate aAbstractResultcompleted without anVaultException.protectedAbstractResult(VaultException exception) Create aAbstractResultcompleted with anVaultException. -
Method Summary
Modifier and TypeMethodDescription@Nullable Vget()Return the result or throw aVaultExceptionif the operation completed with an error.protected abstract @Nullable Vget0()@Nullable ExceptiongetCause()Returns the cause of the failed operation if the operation completed with an error.booleanReturns true if and only if the batch operation was completed successfully.
-
Constructor Details
-
AbstractResult
protected AbstractResult()Create aAbstractResultcompleted without anVaultException. -
AbstractResult
Create aAbstractResultcompleted with anVaultException.- Parameters:
exception- must not be null.
-
-
Method Details
-
isSuccessful
public boolean isSuccessful()Returns true if and only if the batch operation was completed successfully. UsegetCause()to obtain the actual exception if the operation completed with an error.- Returns:
- true if the batch operation was completed successfully.
-
getCause
Returns the cause of the failed operation if the operation completed with an error.- Returns:
- the cause of the failure or null if succeeded.
-
get
Return the result or throw aVaultExceptionif the operation completed with an error. UseisSuccessful()to verify the success status of this result without throwing an exception.- Returns:
- the result value.
- Throws:
VaultException- if the operation completed with an error.
-
get0
- Returns:
- the actual result if this result completed successfully.
-