public interface Constraint extends Serializable
getDescription()
allows anyone to
dynamically redefine this constraint in another language (for example in javascript to make client-side validation).Modifier and Type | Interface and Description |
---|---|
static class |
Constraint.Description
Represent the description of a constraint.
|
Modifier and Type | Field and Description |
---|---|
static String |
MESSAGES_BUNDLE |
static Locale |
MESSAGES_DEFAULT_LANG |
static String |
MESSAGES_KEY |
Modifier and Type | Method and Description |
---|---|
Constraint.Description |
getDescription()
Provides a description of a constraint.
|
String |
getErrorMessage(Object invalidValue,
Locale locale)
Provides an error message to display when some invalid value does not match existing entity.
|
boolean |
validate(Object object)
Validates the given object against this constraint.
|
static final String MESSAGES_BUNDLE
static final Locale MESSAGES_DEFAULT_LANG
static final String MESSAGES_KEY
boolean validate(Object object)
If some object is null. Constraint should return true while validating unless the constraint deals with nullable state.
object
- the object to validateString getErrorMessage(Object invalidValue, Locale locale)
invalidValue
- The invalid value that don't match any entity.locale
- The language in which the message should be generated.Constraint.Description getDescription()
name=PatternMatchingConstraint
| parameters= "pattern":"[0-9]+"
Copyright © 2015 Nuxeo SA. All rights reserved.