Validation

The most important method defined by the Validatable interface is isValid() . It asks all registered validators to verify if the object's value is valid or not. Note that it depends on the validators registered for a object which values are valid and which are not. For example, a null value can be valid value for one validator but invalid for another.

In addition to isValid() , Validatable defines methods to add, remove and list validators of a validatable object.

Validator defines the interface for an external validator. These validators may be added to any Validatable object, and their task is to check, when requested, that the object which they are attached to contains a valid value. The actual validation logic is hidden in the validate(Object) method.

In addition to check(Object) , Validator defines the InvalidValueException which is used to signal that a checked value is invalid, and the Suggestive subinterface which includes functionality to suggest a valid value for the validated object.

<!-- Put @see and @since tags down here. -->