示例#1
0
 /** Retrieve an error by key. */
 public ValidationError error(String key) {
   List<ValidationError> err = errors.get(key);
   if (err == null || err.isEmpty()) {
     return null;
   } else {
     return err.get(0);
   }
 }
示例#2
0
 /**
  * Retrieves the first global error (an error without any key), if it exists.
  *
  * @return An error or <code>null</code>.
  */
 public ValidationError globalError() {
   List<ValidationError> errors = globalErrors();
   if (errors.isEmpty()) {
     return null;
   } else {
     return errors.get(0);
   }
 }