GWT 2.7.0

com.google.gwt.http.client
Class StringValidator

java.lang.Object
  extended by 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
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 if value is null or empty. This method ignores leading and trailing whitespace.

Parameters:
name - the name of the value, used in error messages
value - the string value that needs to be validated
Throws:
java.lang.IllegalArgumentException - if the string is empty, or all whitespace
java.lang.NullPointerException - if the string is null

throwIfNull

public static void throwIfNull(java.lang.String name,
                               java.lang.Object value)
Throws a NullPointerException if the value is null.

Parameters:
name - the name of the value, used in error messages
value - the value that needs to be validated
Throws:
java.lang.NullPointerException - if the value is null

GWT 2.7.0