public class LengthConstraint extends AbstractConstraint
This constraint's bounds are not strict (i.e. >= and <=).
Constraint.Description
MESSAGES_BUNDLE, MESSAGES_DEFAULT_LANG, MESSAGES_KEY
Constructor and Description |
---|
LengthConstraint(Object min,
Object max)
For a fixed length, use min = max values.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Constraint.Description |
getDescription()
Here, value is :
name = parameters = : 5 // only is bounded : 10 // only if bounded |
String |
getErrorMessage(Object invalidValue,
Locale locale)
Provides an error message to display when some invalid value does not match existing entity.
|
Long |
getMax() |
Long |
getMin() |
int |
hashCode() |
boolean |
validate(Object object)
Validates the given object against this constraint.
|
getMessageString, toString
public LengthConstraint(Object min, Object max)
Bounds could be any object having toString representating an integer.
min
- Minimum length for the validated String, use a null value to get unbounded length.max
- Maximum length for the validated String, use a null value to get unbounded length.public boolean validate(Object object)
Constraint
If some object is null. Constraint should return true while validating unless the constraint deals with nullable state.
object
- the object to validatepublic Constraint.Description getDescription()
public Long getMin()
public Long getMax()
public String getErrorMessage(Object invalidValue, Locale locale)
Constraint
getErrorMessage
in interface Constraint
getErrorMessage
in class AbstractConstraint
invalidValue
- The invalid value that don't match any entity.locale
- The language in which the message should be generated.Copyright © 2015 Nuxeo SA. All rights reserved.