Package com.firebase.ui.auth.util
Class Preconditions
- java.lang.Object
-
- com.firebase.ui.auth.util.Preconditions
-
public final class Preconditions extends Object
Precondition checking utility methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkArgument(boolean expression, String errorMessage)
Ensures the truth of an expression involving parameters to the calling method.static void
checkConfigured(Context context, String message, int... ids)
static <T> T
checkNotNull(T val, String errorMessageTemplate, Object... errorMessageArgs)
Ensures that the provided value is not null, and throws aNullPointerException
if it is null, with a message constructed from the provided error template and arguments.static void
checkUnset(Bundle b, String message, String... keys)
static int
checkValidStyle(Context context, int styleId, String errorMessageTemplate, Object... errorMessageArguments)
Ensures that the provided identifier matches a known style resource, and throws anIllegalArgumentException
if the resource cannot be found, or is not a style resource, with a message constructed from the provided error template and arguments.
-
-
-
Method Detail
-
checkNotNull
@NonNull public static <T> T checkNotNull(@Nullable T val, @NonNull String errorMessageTemplate, @Nullable Object... errorMessageArgs)
Ensures that the provided value is not null, and throws aNullPointerException
if it is null, with a message constructed from the provided error template and arguments.
-
checkValidStyle
@StyleRes public static int checkValidStyle(@NonNull Context context, int styleId, @NonNull String errorMessageTemplate, @Nullable Object... errorMessageArguments)
Ensures that the provided identifier matches a known style resource, and throws anIllegalArgumentException
if the resource cannot be found, or is not a style resource, with a message constructed from the provided error template and arguments.
-
checkUnset
public static void checkUnset(@NonNull Bundle b, @Nullable String message, @NonNull String... keys)
-
checkConfigured
public static void checkConfigured(@NonNull Context context, @Nullable String message, @StringRes int... ids)
-
checkArgument
public static void checkArgument(boolean expression, String errorMessage)
Ensures the truth of an expression involving parameters to the calling method.- Parameters:
expression
- a boolean expressionerrorMessage
- the exception message to use if the check fails- Throws:
IllegalArgumentException
- ifexpression
is false
-
-