final class StringValidator
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isEmptyOrNullString(java.lang.String string)
Returns true if the string is empty or null.
|
static void |
throwIfEmptyOrNull(java.lang.String name,
java.lang.String value)
Throws if
value is null or empty. |
static void |
throwIfNull(java.lang.String name,
java.lang.Object value)
Throws a
NullPointerException if the value is null . |
public static boolean isEmptyOrNullString(java.lang.String string)
string
- to test if null or emptypublic static void throwIfEmptyOrNull(java.lang.String name, java.lang.String value)
value
is null
or empty. This method
ignores leading and trailing whitespace.name
- the name of the value, used in error messagesvalue
- the string value that needs to be validatedjava.lang.IllegalArgumentException
- if the string is empty, or all whitespacejava.lang.NullPointerException
- if the string is null
public static void throwIfNull(java.lang.String name, java.lang.Object value)
NullPointerException
if the value is null
.name
- the name of the value, used in error messagesvalue
- the value that needs to be validatedjava.lang.NullPointerException
- if the value is null