Guest User

Untitled

a guest
Jul 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. public abstract class RemoteObserver<A, T extends Response<? extends A>> implements Observer<T<A>> { // Error: Type 'T' does not have Type Parameters
  2.  
  3. @Override
  4. public final void onNext(@NonNull Response response) {
  5. switch (response.code()) {
  6. case HttpsURLConnection.HTTP_OK:
  7. case HttpsURLConnection.HTTP_CREATED:
  8. case HttpsURLConnection.HTTP_ACCEPTED:
  9. case HttpsURLConnection.HTTP_NOT_AUTHORITATIVE:
  10. if (response.body() != null) {
  11. onSuccess(response.body()); // Error: onSuccess(A) cannot be applied to (java.lang.Object)
  12. }
  13. break;
  14.  
  15. case HttpsURLConnection.HTTP_UNAUTHORIZED:
  16. onUnauthorized();
  17. break;
  18.  
  19. default:
  20. onError(new Throwable("Default " + response.code() + " " + response.message()));
  21. }
  22. }
  23.  
  24. public abstract void onSuccess(A response);
  25.  
  26. public abstract void onUnauthorized();
  27.  
  28. public abstract void onError(Throwable T);
  29. }
Add Comment
Please, Sign In to add comment