Interface StorageResult<T>

Type Parameters:
T - the type of data being stored.
All Known Implementing Classes:
StorageResult.ExceptionResult, StorageResult.FailureResult, StorageResult.NoneResult, StorageResult.PartialFailureResult, StorageResult.SuccessResult

The outcome of a storage operation: success, partial failure, failure, exception or none.
  • Method Details

    • qualityCode

      QualityCode qualityCode()
      Returns the quality of the storage operation.
      Returns:
      the quality code.
    • successfulData

      List<T> successfulData()
      Returns the data that was stored.
      Returns:
      an unmodifiable list.
    • failedData

      List<T> failedData()
      Returns the data that failed to store.
      Returns:
      an unmodifiable list.
    • unchangedData

      default List<T> unchangedData()
      Returns the data the engine accepted as equal to what it already holds and did not write: always a subset of successfulData() by reference identity. The write is acknowledged but nothing new is durable.
      Returns:
      an unmodifiable list; empty by default.
    • error

      Returns the exception from the storage operation, if any.
      Returns:
      the exception, or empty.
    • type

      Returns the kind of result.
      Returns:
      the result type.
    • none

      static <T> StorageResult<T> none()
    • success

      static <T> StorageResult<T> success()
    • success

      static <T> StorageResult<T> success(QualityCode qualityCode)
    • success

      static <T> StorageResult<T> success(List<T> successfulData)
    • success

      static <T> StorageResult<T> success(QualityCode qualityCode, List<T> successfulData)
    • success

      static <T> StorageResult<T> success(QualityCode qualityCode, List<T> successfulData, List<T> unchangedData)
    • unsupported

      static <T> StorageResult<T> unsupported(List<T> failedData)
    • failure

      static <T> StorageResult<T> failure(List<T> failedData)
    • failure

      static <T> StorageResult<T> failure(QualityCode qualityCode, List<T> failedData)
    • exception

      static <T> StorageResult<T> exception(Exception error, List<T> failedData)
    • exception

      static <T> StorageResult<T> exception(Exception error, List<T> failedData, QualityCode qualityCode)
    • partialFailure

      static <T> StorageResult<T> partialFailure(List<T> successfulData, List<T> failedData)
    • partialFailure

      static <T> StorageResult<T> partialFailure(List<T> successfulData, List<T> failedData, @Nullable Exception error)
    • partialFailure

      static <T> StorageResult<T> partialFailure(List<T> successfulData, List<T> failedData, @Nullable Exception error, List<T> unchangedData)
    • of

      static <T> StorageResult<T> of(@Nullable List<T> successfulData, @Nullable List<T> failedData)
    • of

      static <T> StorageResult<T> of(@Nullable List<T> successfulData, @Nullable List<T> failedData, Exception error)
    • of

      static <T> StorageResult<T> of(@Nullable List<T> successfulData, @Nullable List<T> failedData, @Nullable List<T> unchangedData)
      As of(List, List), also carrying the subset of successfulData the engine accepted without writing. A call passing both an error and an unchanged list must use the five-argument form.
    • of

      static <T> StorageResult<T> of(QualityCode qualityCode, @Nullable List<T> successfulData, @Nullable List<T> failedData, @Nullable Exception error)
    • of

      static <T> StorageResult<T> of(QualityCode qualityCode, @Nullable List<T> successfulData, @Nullable List<T> failedData, @Nullable Exception error, @Nullable List<T> unchangedData)
    • join

      static <T> StorageResult<T> join(StorageResult<? extends T> result1, StorageResult<? extends T> result2)
      Combines two results into one.
      Type Parameters:
      T - the data type.
      Parameters:
      result1 - the first result.
      result2 - the second result.
      Returns:
      a result combining the data and status of both.