Package com.google.gwt.http.client
Class StringValidator
java.lang.Object
com.google.gwt.http.client.StringValidator
Utility class for validating strings.
TODO(mmendez): Is there a better place for this?
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isEmptyOrNullString
(String string) Returns true if the string is empty or null.static void
throwIfEmptyOrNull
(String name, String value) Throws ifvalue
isnull
or empty.static void
throwIfNull
(String name, Object value) Throws aNullPointerException
if the value isnull
.
-
Method Details
-
isEmptyOrNullString
Returns true if the string is empty or null.- Parameters:
string
- to test if null or empty- Returns:
- true if the string is empty or null
-
throwIfEmptyOrNull
Throws ifvalue
isnull
or empty. This method ignores leading and trailing whitespace.- Parameters:
name
- the name of the value, used in error messagesvalue
- the string value that needs to be validated- Throws:
IllegalArgumentException
- if the string is empty, or all whitespaceNullPointerException
- if the string isnull
-
throwIfNull
Throws aNullPointerException
if the value isnull
.- Parameters:
name
- the name of the value, used in error messagesvalue
- the value that needs to be validated- Throws:
NullPointerException
- if the value isnull
-