|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- the type of the property value.
public interface PropertyConstraint<T>
Defines constraints on a property value and a description to the constraint that can be presented to the user.
Method Summary | |
---|---|
String |
getDescription() Returns a description of the defined constraints. |
String |
getDescription(Locale locale) Returns a localized description of the defined constraints. |
String |
getViolationMessage(Locale locale, Object actualValue) Returns a localized description of the violation message adding the actual value. |
boolean |
isMandatoryConstraint() Determines if the constraint is a check that evaluates if a property is present or not and fails if a value is not present. |
boolean |
isValid(T value) Checks if the given value is valid for constraints in the default group. |
boolean |
isValid(T value, Class<?> group) Checks if the given value is valid only if the constraint is in the given group. |
void |
validate(PropertyDescriptor propertyDescriptor, T value) Checks if the given value is valid for constraints in the default group. |
void |
validate(PropertyDescriptor propertyDescriptor, T value, Class<?> group) Checks if the given value is valid. |
Method Detail |
---|
boolean isMandatoryConstraint()
true
if the constraint is a check for value presence,
false
if it is any regular constraint.
String getDescription(Locale locale)
locale
- the locale to use to fetch a localized description.
String getDescription()
This is not the validation message that is displayed if the validation fails. This is a description of the constraints on a value that must be met to pass the validation process successfully. The description may be displayed to a user prior to request the input of a value.
String getViolationMessage(Locale locale, Object actualValue)
locale
- the locale to use for the message.
actualValue
- the value that has violated the constraint.
boolean isValid(T value)
value
- the value to be checked.
true
if the
value
is valid,
false
otherwise.
boolean isValid(T value, Class<?> group)
value
- the value to be checked.
group
- the validation only takes place if this constraint is in this group or the argument is
null
.
true
if the
value
is valid,
false
otherwise.
void validate(PropertyDescriptor propertyDescriptor, T value) throws PropertyValidationException
propertyDescriptor
- information about the name of the property to validate.
value
- the value to be checked.
PropertyValidationException
- if the
value
is not valid.
void validate(PropertyDescriptor propertyDescriptor, T value, Class<?> group) throws PropertyValidationException
propertyDescriptor
- information about the name of the property to validate.
value
- the value to be checked.
group
- the validation only takes place if this constraint is in this group or the argument is
null
.
PropertyValidationException
- if the
value
is not valid.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |