Class ModelConstraint
- java.lang.Object
-
- io.rocketbase.commons.dto.validation.ModelConstraint
-
public class ModelConstraint extends Object
Object representation of validation constraints defined on a model domain object Sample JSON serialization:{ "model": "io.rocketbase.commons.model.User", "constraints": { "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": ".*" }], "login": [{ "type": "NotNull", "message": "may not be null" }, { "type": "Length", "message": "length must be between 8 and 2147483647", "min": 8, "max": 2147483647 }], "firstName": [{ "type": "NotBlank", "message": "may not be empty" }] } }- See Also:
ValidationConstraint
-
-
Constructor Summary
Constructors Constructor Description ModelConstraint(String modelRef)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ValidationConstraint>addConstraint(String property, ValidationConstraint constraint)Add aValidationConstraintfor a given property for the current represented model
-
-
-
Constructor Detail
-
ModelConstraint
public ModelConstraint(String modelRef)
-
-
Method Detail
-
addConstraint
public List<ValidationConstraint> addConstraint(String property, ValidationConstraint constraint)
Add aValidationConstraintfor a given property for the current represented model- Parameters:
property- model property holding the constraintconstraint-ValidationConstraintinstance to add to model constraints definitions- Returns:
- the updated list of
ValidationConstraintfor the given property parameter.
-
-