protected String buildMessage ( ConstraintViolation violation ) { Path propertyPath = violation . getPropertyPath ( ) ; StringBuilder message = new StringBuilder ( ) ; Iterator < Path . Node > i = propertyPath . iterator ( ) ; while ( i . hasNext ( ) ) { Path . Node node = i . next ( ) ; if ( node . getKind ( ) == ElementKind . METHOD || node . getKind ( ) == ElementKind . CONSTRUCTOR ) { continue ; } message . append ( node . getName ( ) ) ; if ( i . hasNext ( ) ) { message . append ( ' ' ) ; } } message . append ( ": " ) . append ( violation . getMessage ( ) ) ; return message . toString ( ) ; }
Builds a message based on the provided violation .