protected final List < ValidationException > contOnValidationError ( final ValidationTask ... validationTasks ) { final List < ValidationException > errors = new ArrayList <> ( ) ; for ( final ValidationTask validationTask : validationTasks ) { if ( ! validationTask . isRequired ( ) && validationTask . getInput ( ) == null ) { continue ; } if ( ! validationTask . getPattern ( ) . matcher ( validationTask . getInput ( ) ) . matches ( ) ) { errors . add ( new ValidationException ( validationTask . getInput ( ) , validationTask . getErrorMessage ( ) ) ) ; } } return errors ; }
Given one or mote ValidationTasks this method will return a List of ValidationErrors . If the size of the List is 0 no errors were encountered during validation .