Class StringValidator

java.lang.Object
com.google.gwt.http.client.StringValidator

final class StringValidator extends Object
Utility class for validating strings. TODO(mmendez): Is there a better place for this?
  • Method Details

    • isEmptyOrNullString

      public static boolean isEmptyOrNullString(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(String name, 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:
      IllegalArgumentException - if the string is empty, or all whitespace
      NullPointerException - if the string is null
    • throwIfNull

      public static void throwIfNull(String name, 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:
      NullPointerException - if the value is null