Guest User

Untitled

a guest
Nov 13th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. package fr.ippon.androidaacsample.coinsentinel.util
  2.  
  3. class Resource<T> private constructor(val status: Status, val data: T?, val throwable: Throwable?) {
  4. companion object {
  5. fun <T> success(data: T): Resource<T> {
  6. return Resource(Status.SUCCESS, data, null)
  7. }
  8.  
  9. fun <T> error(throwable: Throwable, data: T?): Resource<T> {
  10. return Resource(Status.ERROR, data, throwable)
  11. }
  12.  
  13. fun <T> loading(data: T?): Resource<T> {
  14. return Resource(Status.LOADING, data, null)
  15. }
  16. }
  17. }
Add Comment
Please, Sign In to add comment