public class Preconditions extends Object
com.google.common.base.Preconditions| Modifier and Type | Method and Description |
|---|---|
static String |
checkNotEmpty(String reference)
Check the nullity and emptiness of the given
reference. |
static String |
checkNotEmpty(String reference,
String message)
Check the nullity and emptiness of the given
reference. |
static <T> T |
checkNotNull(T reference)
Check the nullity of the given
reference. |
static <T> T |
checkNotNull(T reference,
String message)
Check the nullity of the given
reference. |
static void |
checkState(boolean state,
String message)
Check the given
state. |
public static <T> T checkNotNull(T reference)
throws NullPointerException
reference.reference - reference to checkreferenceNullPointerException - if the given reference is nullpublic static <T> T checkNotNull(T reference,
@Nullable
String message)
throws NullPointerException
reference.reference - reference to checkmessage - exception message, can be nullreferenceNullPointerException - if the given reference is nullpublic static String checkNotEmpty(String reference) throws IllegalArgumentException
reference.reference - reference to checkreferenceIllegalArgumentException - if the given reference is nullpublic static String checkNotEmpty(String reference, @Nullable String message) throws IllegalArgumentException
reference.reference - reference to checkmessage - exception message, can be nullreferenceIllegalArgumentException - if the given reference is nullpublic static void checkState(boolean state,
@Nullable
String message)
throws IllegalStateException
state.state - the state top checkmessage - exception message, can be nullIllegalStateException - if the given state is falseCopyright © 2017. All Rights Reserved.