Skip to content

Instantly share code, notes, and snippets.

@nsivabalan
Last active October 28, 2020 19:54
Show Gist options
  • Save nsivabalan/22e26a91b1a360543aeee16218cdce75 to your computer and use it in GitHub Desktop.
Save nsivabalan/22e26a91b1a360543aeee16218cdce75 to your computer and use it in GitHub Desktop.
/**
* Interface representing Request's final status. This is a common interface for all network
* transports and each transport is expected to have its own implementation.
*
* @param <T> represents the actual Status object of generic type T.
*/
public interface UberRequestStatus<T> {
/**
* Refers to the Http status code.
*
* @return the http status code.
*/
int getResponseCode();
/** @return {@code true} if the request succeeded, else {@code false}. */
boolean isSuccess();
/** @return the {@link Throwable} instance if request had failed. */
@Nullable
Throwable getThrowable();
/** @return the network transport's specific status object if any. */
@Nullable
T getNetworkTransportStatus();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment