DATATYPE - The data type that is wrapped together with the success indicator@Immutable public class SuccessWithValue<DATATYPE> extends Object implements ISuccessIndicator, IWrapper<DATATYPE>
| Constructor and Description |
|---|
SuccessWithValue(ISuccessIndicator aSuccessIndicator)
Constructor
|
SuccessWithValue(ISuccessIndicator aSuccessIndicator,
DATATYPE aObj)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
static <DATATYPE> SuccessWithValue<DATATYPE> |
create(ISuccessIndicator aSuccessIndicator,
DATATYPE aValue)
Create a new object with the given value.
|
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)
aSuccessIndicator - The success indicator. May not be null.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.public boolean isSet()
@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> create(@Nonnull ISuccessIndicator aSuccessIndicator, @Nullable DATATYPE aValue)
DATATYPE - The data type that is wrapped together with the success indicatoraSuccessIndicator - The success indicator. May not be null.aValue - The value to be used. May be null.null.@Nonnull public static <DATATYPE> SuccessWithValue<DATATYPE> createSuccess(@Nullable DATATYPE aValue)
DATATYPE - The data type that is wrapped together with the success indicatoraValue - The value to be used. May be null.null.@Nonnull public static <DATATYPE> SuccessWithValue<DATATYPE> createFailure(@Nullable DATATYPE aValue)
DATATYPE - The data type that is wrapped together with the success indicatoraValue - The value to be used. May be null.null.Copyright © 2014–2016 Philip Helger. All rights reserved.