void addMessage ( Validator validator , List < ? extends ValidationMessage > messages ) { if ( messages . isEmpty ( ) ) { return ; } final int validatorHash = System . identityHashCode ( validator ) ; if ( ! validatorToMessagesMap . containsKey ( validatorHash ) ) { validatorToMessagesMap . put ( validatorHash , new ArrayList <> ( ) ) ; } final List < Integer > messageHashesOfThisValidator = validatorToMessagesMap . get ( validatorHash ) ; // add the hashCodes of the messages to the internal map messages . stream ( ) . map ( System :: identityHashCode ) . forEach ( messageHashesOfThisValidator :: add ) ; // add the actual messages to the message list so that they are accessible by the user. getMessagesInternal ( ) . addAll ( messages ) ; }
Add a list of validation messages for the specified validator .