Class ModelConstraint
java.lang.Object
io.rocketbase.commons.dto.validation.ModelConstraint
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddConstraint(String property, ValidationConstraint constraint) Add aValidationConstraintfor a given property for the current represented model
-
Constructor Details
-
ModelConstraint
-
-
Method Details
-
addConstraint
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.
-