-
@RestrictTo(value = RestrictTo.Scope.LIBRARY_GROUP) public final class Resource<T>
Base state model object.
This state can either be successful or not. In either case, it must be complete to represent these states.
-
-
Method Summary
Modifier and Type Method Description static <T> Resource<T>forSuccess(@NonNull() T value)Creates a successful resource containing a value. static <T> Resource<T>forFailure(@NonNull() 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. StategetState()final ExceptiongetException()TgetValue()booleanisUsed()booleanequals(Object o)inthashCode()StringtoString()-
-
Method Detail
-
forSuccess
@NonNull() static <T> Resource<T> forSuccess(@NonNull() T value)
Creates a successful resource containing a value.
-
forFailure
@NonNull() static <T> Resource<T> forFailure(@NonNull() Exception e)
Creates a failed resource with an exception.
-
forLoading
@NonNull() static <T> Resource<T> forLoading()
Creates a resource in the loading state, without a value or an exception.
-
getException
@Nullable() final Exception getException()
-
isUsed
boolean isUsed()
-
hashCode
int hashCode()
-
-
-
-