public static String composeMessage ( List < ValidationResult > results ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "Validation failed" ) ; if ( results != null && results . size ( ) > 0 ) { boolean first = true ; for ( ValidationResult result : results ) { if ( result . getType ( ) != ValidationResultType . Information ) { if ( ! first ) builder . append ( ": " ) ; else builder . append ( ", " ) ; builder . append ( result . getMessage ( ) ) ; first = false ; } } } return builder . toString ( ) ; }
Composes human readable error message based on validation results .