Class ValidationConstraint

java.lang.Object
io.rocketbase.commons.dto.validation.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 Details

    • ValidationConstraint

      public ValidationConstraint()
  • Method Details

    • getAttributes

      public Map<String,Object> getAttributes()
    • 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.