Package com.google.gwt.http.client
Class StringValidator
- java.lang.Object
-
- com.google.gwt.http.client.StringValidator
-
final class StringValidator extends java.lang.ObjectUtility 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 booleanisEmptyOrNullString(java.lang.String string)Returns true if the string is empty or null.static voidthrowIfEmptyOrNull(java.lang.String name, java.lang.String value)Throws ifvalueisnullor empty.static voidthrowIfNull(java.lang.String name, java.lang.Object value)Throws aNullPointerExceptionif 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 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:
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 aNullPointerExceptionif 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
-
-