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
public sealed interface StorageResult<T>
permits StorageResult.SuccessResult<T>, StorageResult.PartialFailureResult<T>, StorageResult.FailureResult<T>, StorageResult.ExceptionResult<T>, StorageResult.NoneResult<T>
The outcome of a storage operation: success, partial failure, failure, exception or none.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordThe operation threw an exception.static final recordAll data failed to store.static final recordNothing was stored or attempted.static final recordSome data was stored and some failed.static final recordAll data was stored.static enum -
Method Summary
Modifier and TypeMethodDescriptionerror()Returns the exception from the storage operation, if any.static <T> StorageResult<T> static <T> StorageResult<T> exception(Exception error, List<T> failedData, QualityCode qualityCode) Returns the data that failed to store.static <T> StorageResult<T> failure(QualityCode qualityCode, List<T> failedData) static <T> StorageResult<T> static <T> StorageResult<T> join(StorageResult<? extends T> result1, StorageResult<? extends T> result2) Combines two results into one.static <T> StorageResult<T> none()static <T> StorageResult<T> of(QualityCode qualityCode, @Nullable List<T> successfulData, @Nullable List<T> failedData, @Nullable Exception error) static <T> StorageResult<T> of(QualityCode qualityCode, @Nullable List<T> successfulData, @Nullable List<T> failedData, @Nullable Exception error, @Nullable List<T> unchangedData) static <T> StorageResult<T> static <T> StorageResult<T> static <T> StorageResult<T> Asof(List, List), also carrying the subset ofsuccessfulDatathe engine accepted without writing.static <T> StorageResult<T> partialFailure(List<T> successfulData, List<T> failedData) static <T> StorageResult<T> partialFailure(List<T> successfulData, List<T> failedData, @Nullable Exception error) static <T> StorageResult<T> partialFailure(List<T> successfulData, List<T> failedData, @Nullable Exception error, List<T> unchangedData) Returns the quality of the storage operation.static <T> StorageResult<T> success()static <T> StorageResult<T> success(QualityCode qualityCode) static <T> StorageResult<T> success(QualityCode qualityCode, List<T> successfulData) static <T> StorageResult<T> success(QualityCode qualityCode, List<T> successfulData, List<T> unchangedData) static <T> StorageResult<T> Returns the data that was stored.type()Returns the kind of result.Returns the data the engine accepted as equal to what it already holds and did not write: always a subset ofsuccessfulData()by reference identity.static <T> StorageResult<T> unsupported(List<T> failedData)
-
Method Details
-
qualityCode
-
successfulData
-
failedData
-
unchangedData
Returns the data the engine accepted as equal to what it already holds and did not write: always a subset ofsuccessfulData()by reference identity. The write is acknowledged but nothing new is durable.- Returns:
- an unmodifiable list; empty by default.
-
error
-
type
-
none
-
success
-
success
-
success
-
success
-
success
static <T> StorageResult<T> success(QualityCode qualityCode, List<T> successfulData, List<T> unchangedData) -
unsupported
-
failure
-
failure
-
exception
-
exception
-
partialFailure
-
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
-
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) Asof(List, List), also carrying the subset ofsuccessfulDatathe 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.
-