public final class PreConditions
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
checkEmptyString(java.lang.String str,
java.lang.String errorMsg)
Ensures the string passed to the method is not empty .
|
static void |
checkExpression(boolean expression,
java.lang.String errorMsg)
Ensures the truth of the expression passed.
|
static <T> void |
checkNull(T t,
java.lang.String errorMsg)
Ensures the object passed to the method is not null
|
public static <T> void checkNull(T t, java.lang.String errorMsg)
t
- The object against which the validation will be performederrorMsg
- The message to throw in case t
turns out to be null.java.lang.IllegalArgumentException
- if t
is nullpublic static void checkEmptyString(java.lang.String str, java.lang.String errorMsg)
str
- The string against which the validation will be performederrorMsg
- The message to throw in case str
turns out to have no text.java.lang.IllegalArgumentException
- if str
has no textpublic static void checkExpression(boolean expression, java.lang.String errorMsg)
expression
- The expression being evaluatederrorMsg
- The message to throw in case expression
turns out to be false.java.lang.IllegalArgumentException
- if expression
is expression