|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
Validator
Method Summary | |
void |
addValidator(Validator validator)
Adds a new validator for this object. |
java.util.Collection |
getValidators()
List all validators currently registered for the object. |
boolean |
isInvalidAllowed()
Does the validabtable object accept invalid values. |
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. |
void |
setInvalidAllowed(boolean invalidValueAllowed)
Should the validabtable object accept invalid values. |
void |
validate()
Checks the validity of the validatable. |
Method Detail |
public void addValidator(Validator validator)
Validator.validate(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.
validator
- the new validatorpublic void removeValidator(Validator validator)
validate
method is no longer called in isValid()
.
validator
- the validator to removepublic java.util.Collection getValidators()
null
.
null
public boolean isValid()
Validator.validate(Object)
method is called. If any validator
throws the Validator.InvalidValueException
this method
returns false
.
true
if the registered validators concur that
the value is valid, false
otherwisepublic void validate() throws Validator.InvalidValueException
Validator.InvalidValueException
Validator.InvalidValueException
- if the value is not validpublic boolean isInvalidAllowed()
public void setInvalidAllowed(boolean invalidValueAllowed) throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |