public boolean addValidationConstraint ( String type , String field , Constraint c ) { if ( ! StringUtils . isBlank ( type ) && ! StringUtils . isBlank ( field ) && c != null && ! c . getPayload ( ) . isEmpty ( ) && Constraint . isValidConstraintName ( c . getName ( ) ) ) { Map < String , Map < String , Map < String , ? > > > fieldMap = getValidationConstraints ( ) . get ( type ) ; Map < String , Map < String , ? > > consMap ; if ( fieldMap != null ) { consMap = fieldMap . get ( field ) ; if ( consMap == null ) { consMap = new LinkedHashMap <> ( ) ; } } else { fieldMap = new LinkedHashMap <> ( ) ; consMap = new LinkedHashMap <> ( ) ; } consMap . put ( c . getName ( ) , c . getPayload ( ) ) ; fieldMap . put ( field , consMap ) ; getValidationConstraints ( ) . put ( type , fieldMap ) ; return true ; } return false ; }
Adds a new constraint to the list of constraints for a given field and type .