DATATYPE - The data type that is wrapped together with the success indicator@Immutable public class SuccessWithValue<DATATYPE> extends Object implements ISuccessIndicator, IReadonlyWrapper<DATATYPE>
| Constructor and Description |
|---|
SuccessWithValue(ISuccessIndicator aSuccessIndicator,
DATATYPE aObj)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
static <DATATYPE> SuccessWithValue<DATATYPE> |
createFailure(DATATYPE aValue)
Create a new failure object with the given value.
|
static <DATATYPE> SuccessWithValue<DATATYPE> |
createSuccess(DATATYPE aValue)
Create a new success object with the given value.
|
boolean |
equals(Object o) |
DATATYPE |
get() |
DATATYPE |
getIfFailure(DATATYPE aSuccessValue)
Get the store value if this is a failure.
|
DATATYPE |
getIfFailureOrNull()
Get the store value if this is a failure.
|
DATATYPE |
getIfSuccess(DATATYPE aFailureValue)
Get the store value if this is a success.
|
DATATYPE |
getIfSuccessOrNull()
Get the store value if this is a success.
|
int |
hashCode() |
boolean |
isFailure() |
boolean |
isSet() |
boolean |
isSuccess() |
String |
toString() |
public SuccessWithValue(@Nonnull ISuccessIndicator aSuccessIndicator, @Nullable DATATYPE aObj)
aSuccessIndicator - The success indicator. May not be null.aObj - The assigned value. May be null.public boolean isSuccess()
isSuccess in interface ISuccessIndicatortrue on success and false on failure.public boolean isFailure()
isFailure in interface ISuccessIndicatortrue on failure and false on success.@Nullable public DATATYPE get()
get in interface IReadonlyWrapper<DATATYPE>null.public boolean isSet()
isSet in interface IReadonlyWrapper<DATATYPE>true if the contained value is not null,
false if it is null.@Nullable public DATATYPE getIfSuccess(@Nullable DATATYPE aFailureValue)
aFailureValue - The failure value to be used. May be null.null.@Nullable public DATATYPE getIfSuccessOrNull()
null is
returned.null.@Nullable public DATATYPE getIfFailure(@Nullable DATATYPE aSuccessValue)
aSuccessValue - The failure value to be used. May be null.null.@Nullable public DATATYPE getIfFailureOrNull()
null is
returned.null.@Nonnull public static <DATATYPE> SuccessWithValue<DATATYPE> createSuccess(@Nullable DATATYPE aValue)
aValue - The value to be used. May be null.null.@Nonnull public static <DATATYPE> SuccessWithValue<DATATYPE> createFailure(@Nullable DATATYPE aValue)
aValue - The value to be used. May be null.null.Copyright © 2006–2014 phloc systems. All rights reserved.