public class ModelConstraint extends Object
{
"model": "org.resthub.validation.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"
}]
}
}
< ModelConstraint>
< model>org.resthub.validation.model.User
< constraints>
< lastName>
< type>NotBlank
< message>may not be empty
< /lastName>
< email>
< type>NotNull
< message>may not be null
< /email>
< email>
< type>Email
< message>not a well-formed email address
< regexp>.*
< /email>
< login>
< type>NotNull
< message>may not be null
< /login>
< login>
< type>Length
< message>length must be between 8 and 2147483647
< min>8
< max>2147483647
< /login>
< firstName>
< type>NotBlank
< message>may not be empty
< /firstName>
< /constraints>
< /ModelConstraint>
ValidationConstraint| Constructor and Description |
|---|
ModelConstraint(String modelRef) |
| Modifier and Type | Method and Description |
|---|---|
List<ValidationConstraint> |
addConstraint(String property,
ValidationConstraint constraint)
Add a
ValidationConstraint for a given property for the current represented model |
boolean |
equals(Object o) |
Map<String,List<ValidationConstraint>> |
getConstraints() |
String |
getModelRef() |
int |
hashCode() |
void |
setConstraints(Map<String,List<ValidationConstraint>> constraints) |
void |
setModelRef(String modelRef) |
public ModelConstraint(String modelRef)
public String getModelRef()
public void setModelRef(String modelRef)
public Map<String,List<ValidationConstraint>> getConstraints()
public void setConstraints(Map<String,List<ValidationConstraint>> constraints)
public List<ValidationConstraint> addConstraint(String property, ValidationConstraint constraint)
ValidationConstraint for a given property for the current represented modelproperty - model property holding the constraintconstraint - ValidationConstraint instance to add to model constraints definitionsValidationConstraint for the given property parameter.Copyright © 2009–2014. All rights reserved.