Created
March 13, 2018 13:41
-
-
Save ntakouris/bbea97d30296028d00ab9af54db78e73 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Callback<T> { | |
default void onSuccessfulResponse(ResponseBody<T> responseBody) { | |
} | |
default void onBadRequest(List<ErrorModel> errors) { | |
} | |
default void onServerError(Response response) { | |
} | |
default void onUnAuthorized() { | |
} | |
default void onForbidden() { | |
} | |
default void onFailure(boolean cancelled) { | |
} | |
default void onEverytime() { | |
} | |
} | |
public interface SimpleCallback<T> extends Callback<T> { | |
@Override | |
default void onBadRequest(List<ErrorModel> errors) { | |
onNoSuccess(); | |
} | |
@Override | |
default void onServerError(Response response) { | |
onNoSuccess(); | |
} | |
@Override | |
default void onUnAuthorized() { | |
onNoSuccess(); | |
} | |
@Override | |
default void onForbidden() { | |
onNoSuccess(); | |
} | |
@Override | |
default void onFailure(boolean cancelled) { | |
onNoSuccess(); | |
} | |
void onNoSuccess(); | |
} | |
public interface DoNothingCallback<T> extends SimpleCallback<T> { | |
@Override | |
default void onNoSuccess() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment