public final class Preconditions extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkArgument(boolean expression,
Object errorMessage)
Ensures the truth of an expression involving one or more parameters to
the calling method.
|
static <T> T |
checkNotNull(T reference,
Object errorMessage)
Ensures that an object reference passed as a parameter to the calling
method is not null.
|
public static void checkArgument(boolean expression,
Object errorMessage)
expression - a boolean expressionerrorMessage - the exception message to use if the check fails; will be
converted to a string using String.valueOf(Object)IllegalArgumentException - if expression is falsepublic static <T> T checkNotNull(T reference,
Object errorMessage)
T - type of object referencereference - an object referenceerrorMessage - the exception message to use if the check fails; will be
converted to a string using String.valueOf(Object)NullPointerException - if reference is nullCopyright © 2013–2017. All rights reserved.