Class ValidationConstraint


  • public class ValidationConstraint
    extends Object
    Object representation of validation constraints. Sample JSON serialization:
              "lastName": [{
                  "type": "NotBlank",
                  "message": "may not be empty"
              }],
              "email": [{
                  "type": "NotNull",
                  "message": "may not be null"
               }, {
                  "type": "Email",
                  "message": "not a well-formed email address",
                  "flags": [],
                  "regexp": ".*"
              }]
     
    • Constructor Detail

      • ValidationConstraint

        public ValidationConstraint()
    • Method Detail

      • setAttributes

        public void setAttributes​(Map<String,​Object> attributes)
      • addAttribute

        public Object addAttribute​(String attrKey,
                                   Object attribute)
        Add attribute to the current constraint definition.
        Parameters:
        attrKey - attribute key identifier
        attribute - attribute value
        Returns:
        the previous value associated with attrKey, or null if there was no mapping for attrKey.