| org.millstone.base.data.Validatable
All known Subclasses: org.millstone.base.ui.Form,
Validatable | public interface Validatable (Code) | | 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.
author: IT Mill Ltd. version: 3.1.1 since: 3.0 See Also: org.millstone.base.data.Validator |
Method Summary | |
void | addValidator(Validator validator) Adds a new validator for this object. | public Collection | getValidators() List all validators currently registered for the object. | public boolean | isInvalidAllowed() Does the validabtable object accept invalid values. | public boolean | isValid() Tests the current value of the object against all registered
validators. | void | removeValidator(Validator validator) Removes a previously registered validator from the object. | public void | setInvalidAllowed(boolean invalidValueAllowed) Should the validabtable object accept invalid values. | public void | validate() Checks the validity of the validatable. |
addValidator | void addValidator(Validator validator)(Code) | | Adds a new validator for this object. The validator's
Validator.validate(Object) method is activated every time the
object's value needs to be verified, that is, when the
Validatable.isValid() method is called. This usually happens when the
object's value changes.
Parameters: validator - the new validator |
getValidators | public Collection getValidators()(Code) | | List all validators currently registered for the object. If no
validators are registered, returns null .
collection of validators or null |
isInvalidAllowed | public boolean isInvalidAllowed()(Code) | | Does the validabtable object accept invalid values. The default is true.
|
isValid | public boolean isValid()(Code) | | Tests the current value of the object against all registered
validators. The registered validators are iterated and for each the
Validator.validate(Object) method is called. If any validator
throws the
Validator.InvalidValueException this method
returns false .
true if the registered validators concur thatthe value is valid, false otherwise |
removeValidator | void removeValidator(Validator validator)(Code) | | 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
Validatable.isValid() .
Parameters: validator - the validator to remove |
setInvalidAllowed | public void setInvalidAllowed(boolean invalidValueAllowed) throws UnsupportedOperationException(Code) | | Should the validabtable object accept invalid values. Supporting
this configuration possibility is optional. By default invalid values are
alloved.
|
|
|