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 booleanisEmptyOrNullString(String string) Returns true if the string is empty or null.static voidthrowIfEmptyOrNull(String name, String value) Throws ifvalueisnullor empty.static voidthrowIfNull(String name, Object value) Throws aNullPointerExceptionif 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 ifvalueisnullor 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 aNullPointerExceptionif 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
-