Class AbstractResult<V>

java.lang.Object
org.springframework.vault.support.AbstractResult<V>
Direct Known Subclasses:
VaultDecryptionResult, VaultEncryptionResult, VaultTransformDecodeResult, VaultTransformEncodeResult

public abstract class AbstractResult<V> extends Object
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 Details

    • AbstractResult

      protected AbstractResult()
      Create a AbstractResult completed without an VaultException.
    • AbstractResult

      protected AbstractResult(VaultException exception)
      Create a AbstractResult completed with an VaultException.
      Parameters:
      exception - must not be null.
  • Method Details

    • isSuccessful

      public boolean isSuccessful()
      Return true if and only if the batch operation was completed successfully. Use getCause() to obtain the actual exception if the operation completed with an error.
      Returns:
      true if the batch operation was completed successfully.
    • getCause

      public @Nullable Exception getCause()
      Return the cause of the failed operation if the operation completed with an error.
      Returns:
      the cause of the failure or null if succeeded.
    • get

      public @Nullable V get()
      Return the result or throw a VaultException if the operation completed with an error. Use isSuccessful() 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

      protected abstract @Nullable V get0()
      Returns:
      the actual result if this result completed successfully.