public class Utils
extends java.lang.Object
| Modifier and Type | Method | Description |
|---|---|---|
static <T> T |
coalesce(T value,
T theDefault) |
Returns the first non-`null` value of its arguments.
|
static boolean |
isHttpStatusCode(java.lang.Throwable throwable,
int statusCode) |
Returns true if the Throwable is an instance of RetrofitError with an
http status code equals to the given one.
|
static boolean |
isNotNull(java.lang.Object object) |
|
static boolean |
isNull(java.lang.Object object) |
|
MomoApiError |
parseError(retrofit2.Response<com.google.gson.JsonObject> response) |
|
static <T> T |
requireNonNull(T value) |
Cast a `null`able value into a non-`null` value, and throw a `NullPointerException` if the value is `null`.
|
static <T> T |
requireNonNull(T value,
java.lang.Class<T> klass) |
Cast a `null`able value into a non-`null` value, and throw a `NullPointerException` if the value is `null`.
|
static <T> T |
requireNonNull(T value,
java.lang.String message) |
Cast a `null`able value into a non-`null` value, and throw a `NullPointerException` if the value is `null`.
|
static java.lang.Boolean |
toBoolean(java.lang.String s) |
Converts a
String to a Boolean, or null if the boolean cannot be parsed. |
static java.lang.Integer |
toInteger(java.lang.String s) |
Converts a
String to an Integer, or null if the integer cannot be parsed. |
static java.lang.String |
toString(java.lang.Double n) |
Converts a
Double to a String, can be null if the double is also null. |
static java.lang.String |
toString(java.lang.Float n) |
Converts a
Float to a String, can be null if the float is also null. |
static java.lang.String |
toString(java.lang.Integer n) |
Converts an
Integer to a String, can be null if the integer is also null. |
static java.lang.String |
toString(java.lang.Long n) |
Converts a
Long to a String, can be null if the long is also null. |
public static boolean isNull(@Nullable
java.lang.Object object)
public static boolean isNotNull(@Nullable
java.lang.Object object)
@NonNull
public static <T> T coalesce(@Nullable
T value,
@NonNull
T theDefault)
@Nullable
public static java.lang.Boolean toBoolean(@Nullable
java.lang.String s)
String to a Boolean, or null if the boolean cannot be parsed.@Nullable
public static java.lang.Integer toInteger(@Nullable
java.lang.String s)
String to an Integer, or null if the integer cannot be parsed.@Nullable
public static java.lang.String toString(@Nullable
java.lang.Integer n)
Integer to a String, can be null if the integer is also null.@Nullable
public static java.lang.String toString(@Nullable
java.lang.Long n)
Long to a String, can be null if the long is also null.@Nullable
public static java.lang.String toString(@Nullable
java.lang.Float n)
Float to a String, can be null if the float is also null.@Nullable
public static java.lang.String toString(@Nullable
java.lang.Double n)
Double to a String, can be null if the double is also null.@NonNull
public static <T> T requireNonNull(@Nullable
T value)
throws java.lang.NullPointerException
java.lang.NullPointerException@NonNull
public static <T> T requireNonNull(@Nullable
T value,
@NonNull
java.lang.Class<T> klass)
throws java.lang.NullPointerException
java.lang.NullPointerException@NonNull
public static <T> T requireNonNull(@Nullable
T value,
@NonNull
java.lang.String message)
throws java.lang.NullPointerException
java.lang.NullPointerExceptionpublic static boolean isHttpStatusCode(java.lang.Throwable throwable,
int statusCode)
public MomoApiError parseError(retrofit2.Response<com.google.gson.JsonObject> response)