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
ModifierConstructorDescriptionprotected
Create aAbstractResult
completed without anVaultException
.protected
AbstractResult
(VaultException exception) Create aAbstractResult
completed with anVaultException
. -
Method Summary
Modifier and TypeMethodDescriptionget()
Return the result or throw aVaultException
if the operation completed with an error.protected abstract V
get0()
getCause()
Returns the cause of the failed operation if the operation completed with an error.boolean
Returns true if and only if the batch operation was completed successfully.
-
Constructor Details
-
AbstractResult
protected AbstractResult()Create aAbstractResult
completed without anVaultException
. -
AbstractResult
Create aAbstractResult
completed 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 aVaultException
if 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.
-