public interface Constraint
Modifier and Type | Field and Description |
---|---|
static String |
EXCEEDED_SUFFIX |
static String |
INVALID_SUFFIX |
static String |
NOT_PREFIX |
static String |
NOTMET_SUFFIX |
static String |
TOOBIG_SUFFIX |
static String |
TOOLONG_SUFFIX |
static String |
TOOSHORT_SUFFIX |
static String |
TOOSMALL_SUFFIX |
Modifier and Type | Method and Description |
---|---|
String |
getName() |
Object |
getParameter() |
String |
getPropertyName() |
boolean |
isValid()
Return whether the constraint is valid for the owning class
|
void |
setMessageSource(MessageSource source)
The message source to evaluate the default messages from
|
void |
setOwningClass(Class<?> owningClass)
The class the constraint applies to
|
void |
setParameter(Object parameter)
The parameter which the constraint is validated against.
|
void |
setPropertyName(String propertyName)
The name of the property the constraint applies to
|
boolean |
supports(Class<?> type)
Returns whether the constraint supports being applied against the specified type;
|
void |
validate(Object target,
Object propertyValue,
Errors errors)
Validate this constraint against a property value.
|
static final String INVALID_SUFFIX
static final String EXCEEDED_SUFFIX
static final String NOTMET_SUFFIX
static final String NOT_PREFIX
static final String TOOBIG_SUFFIX
static final String TOOLONG_SUFFIX
static final String TOOSMALL_SUFFIX
static final String TOOSHORT_SUFFIX
boolean supports(@Nonnull Class<?> type)
type
- The type to supportboolean isValid()
void validate(@Nonnull Object target, @Nullable Object propertyValue, @Nonnull Errors errors)
target
- propertyValue
- The property value to validateerrors
- The errors instance to record errors againstvoid setParameter(@Nonnull Object parameter)
parameter
- void setOwningClass(@Nonnull Class<?> owningClass)
owningClass
- void setPropertyName(@Nonnull String propertyName)
propertyName
- void setMessageSource(@Nonnull MessageSource source)
source
-