public final class Resource<T> extends Object
This state can either be successful or not. In either case, it must be complete to represent these states.
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
static <T> Resource<T> |
forFailure(Exception e)
Creates a failed resource with an exception.
|
static <T> Resource<T> |
forLoading()
Creates a resource in the loading state, without a value or an exception.
|
static <T> Resource<T> |
forSuccess(T value)
Creates a successful resource containing a value.
|
Exception |
getException() |
State |
getState() |
T |
getValue() |
int |
hashCode() |
boolean |
isUsed() |
String |
toString() |
@NonNull public static <T> Resource<T> forSuccess(@NonNull T value)
@NonNull public static <T> Resource<T> forFailure(@NonNull Exception e)
@NonNull public static <T> Resource<T> forLoading()
@NonNull public State getState()
@Nullable public final Exception getException()
@Nullable public T getValue()
public boolean isUsed()