notBlank static method
Validate that the specified string is neither [null], a length of zero (no characters), empty nor whitespace; otherwise throwing an exception with the specified message.
Validate.notBlank(myString, "The string must not be blank");
value
the string to check, validated not null by this method
message
the exception message if invalid, not null
Returns the validated string
Throws ArgumentError if the character sequence is null
Throws ArgumentError if the character sequence is blank
Implementation
static String notBlank(final String value,
[String message = DEFAULT_NOT_BLANK_EX_MESSAGE]) {
GValidate.notNull(value, message);
if ((value is String) == false || value.trim().isEmpty) {
throw new ArgumentError(message);
}
return value;
}