Interface for validatable objects. Defines methods to verify if the object's value is valid or not, and to add, remove and list registered validators of the object.
3.0
com.itmill.toolkit.data.Validator
Inheritance Path. com.itmill.toolkit.data.Validatable
Parameters
validator
the new validator
Adds a new validator for this object. The validator's
validate(java.lang.Object)
method is activated every time the
object's value needs to be verified, that is, when the
isValid()
method is called. This usually happens when the
object's value changes.
Parameters
collection of validators or
null
List all validators currently registered for the object. If no
validators are registered, returns
null
.
Parameters
true
if the registered validators concur that
the value is valid,
false
otherwise
Tests the current value of the object against all registered
validators. The registered validators are iterated and for each the
validate(java.lang.Object)
method is called. If any validator
throws the
com.itmill.toolkit.data.Validator.InvalidValueException
this method
returns
false
.
Parameters
validator
the validator to remove
Removes a previously registered validator from the object. The
specified validator is removed from the object and its
validate
method is no longer called in
isValid()
.
Should the validabtable object accept invalid values. Supporting this configuration possibility is optional. By default invalid values are alloved.