/** * Validates string parameter to be non-empty string (null value allowed). * * @param param The string parameter. * @param paramName Name of the parameter. * @throws ArgumentException * @throws ServiceLocalException */ public static void validateNonBlankStringParamAllowNull(String param, String paramName) throws ArgumentException, ServiceLocalException { if (param != null) { // Non-empty string has at least one character //which is *not* a whitespace character if (param.length() == countMatchingChars(param, new IPredicate<Character>() { @Override public boolean predicate(Character obj) { return Character.isWhitespace(obj); } })) { throw new ArgumentException("The string argument contains only white space characters.", paramName); } } }
/** * Validates string parameter to be non-empty string (null value allowed). * * @param param The string parameter. * @param paramName Name of the parameter. * @throws ArgumentException * @throws ServiceLocalException */ public static void validateNonBlankStringParamAllowNull(String param, String paramName) throws ArgumentException, ServiceLocalException { if (param != null) { // Non-empty string has at least one character //which is *not* a whitespace character if (param.length() == countMatchingChars(param, new IPredicate<Character>() { @Override public boolean predicate(Character obj) { return Character.isWhitespace(obj); } })) { throw new ArgumentException("The string argument contains only white space characters.", paramName); } } }