Package com.google.gwt.http.client
Class StringValidator
- java.lang.Object
-
- com.google.gwt.http.client.StringValidator
-
final class StringValidator extends java.lang.Object
Utility class for validating strings. TODO(mmendez): Is there a better place for this?
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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 ifvalue
isnull
or empty.static void
throwIfNull(java.lang.String name, java.lang.Object value)
Throws aNullPointerException
if the value isnull
.
-
-
-
Method Detail
-
isEmptyOrNullString
public static boolean isEmptyOrNullString(java.lang.String string)
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
public static void throwIfEmptyOrNull(java.lang.String name, java.lang.String value)
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:
java.lang.IllegalArgumentException
- if the string is empty, or all whitespacejava.lang.NullPointerException
- if the string isnull
-
throwIfNull
public static void throwIfNull(java.lang.String name, java.lang.Object value)
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:
java.lang.NullPointerException
- if the value isnull
-
-