public class ConditionUtil extends Object
Constructor and Description |
---|
ConditionUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
checkArgument(boolean expression)
Ensures the truth of an expression involving one or more parameters to the calling method.
|
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)
Ensures that an object reference passed as a parameter to the calling method is not null.
|
static <T> T |
checkNotNull(T reference,
Object errorMessage)
Deprecated.
use Objects.requireNonNull instead
|
static boolean |
isNullOrEmpty(String string)
Returns
true if the given string is null or is the empty string. |
public static <T> T checkNotNull(T reference)
reference
- an object referenceNullPointerException
- if reference
is nullpublic static void checkArgument(boolean expression)
expression
- a boolean expressionIllegalArgumentException
- if expression
is falsepublic 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 false@Deprecated public static <T> T checkNotNull(T reference, Object errorMessage)
reference
- 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 nullpublic static boolean isNullOrEmpty(String string)
true
if the given string is null or is the empty string.string
- a string reference to checktrue
if the string is null or is the empty stringCopyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries