1 16 package com.google.gwt.http.client; 17 18 23 final class StringValidator { 24 31 public static boolean isEmptyOrNullString(String string) { 32 return (string == null) || (0 == string.trim().length()); 33 } 34 35 45 public static void throwIfEmptyOrNull(String name, String value) { 46 assert (name != null); 47 assert (name.trim().length() != 0); 48 49 throwIfNull(name, value); 50 51 if (0 == value.trim().length()) { 52 throw new IllegalArgumentException (name + " can not be empty"); 53 } 54 } 55 56 64 public static void throwIfNull(String name, String value) { 65 if (null == value) { 66 throw new NullPointerException (name + " can not be null"); 67 } 68 } 69 70 private StringValidator() { 71 } 72 } 73 | Popular Tags |