Class Resource<T>


  • public final class Resource<T>
    extends Object
    Base state model object.

    This state can either be successful or not. In either case, it must be complete to represent these states.

    • Method Detail

      • forSuccess

        @NonNull
        public static <T> Resource<T> forSuccess​(@NonNull
                                                 T value)
        Creates a successful resource containing a value.
      • forFailure

        @NonNull
        public static <T> Resource<T> forFailure​(@NonNull
                                                 Exception e)
        Creates a failed resource with an exception.
      • forLoading

        @NonNull
        public static <T> Resource<T> forLoading()
        Creates a resource in the loading state, without a value or an exception.
      • getState

        @NonNull
        public State getState()
      • getException

        @Nullable
        public final Exception getException()
      • getValue

        @Nullable
        public T getValue()
      • isUsed

        public boolean isUsed()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object