I want to write validation for all fields of a Java bean.
My method for blank validation is
private static boolean isBlank(String value) {
return value.equalsIgnoreCase("")?true:false;
}
I am passing all properties of bean to the isBlank() method, and want to get out of this method when any property is blank. like this-
public static boolean isValid(User user) {
isBlank(user.getPersonId())?return false:{I want to stay here and check next};
isBlank(user.getEmployeeNumber());
isBlank(user.getFullName());
.
.
}
How can I achieve this in minimum possible code.