protected String extractCategory ( ValuedParameter [ ] params , ConstraintViolation < Object > violation ) { Iterator < Node > path = violation . getPropertyPath ( ) . iterator ( ) ; Node method = path . next ( ) ; logger . debug ( "Constraint violation on method {}: {}" , method , violation ) ; StringBuilder cat = new StringBuilder ( ) ; cat . append ( params [ path . next ( ) . as ( ParameterNode . class ) . getParameterIndex ( ) ] . getName ( ) ) ; // parameter name while ( path . hasNext ( ) ) { cat . append ( "." ) . append ( path . next ( ) ) ; } return cat . toString ( ) ; }
Returns the category for this constraint violation . By default the category returned is the full path for property . You can override this method if you prefer another strategy .