|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.data.validator.AbstractValidator
public abstract class AbstractValidator
Abstract Validator
implementation that
provides a basic Validator implementation except the Validator.isValid(Object)
method. Sub-classes need to implement the Validator.isValid(Object)
method.
To include the value that failed validation in the exception message you can
use "{0}" in the error message. This will be replaced with the failed value
(converted to string using Object.toString()
) or "null" if the value is
null.
The default implementation of AbstractValidator does not support HTML in
error messages. To enable HTML support, override
InvalidValueException#getHtmlMessage()
and throw such exceptions from
validate(Object)
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.vaadin.data.Validator |
---|
Validator.EmptyValueException, Validator.InvalidValueException |
Constructor Summary | |
---|---|
AbstractValidator(String errorMessage)
Constructs a validator with the given error message. |
Method Summary | |
---|---|
String |
getErrorMessage()
Returns the message to be included in the exception in case the value does not validate. |
void |
setErrorMessage(String errorMessage)
Sets the message to be included in the exception in case the value does not validate. |
void |
validate(Object value)
Checks the given value against this validator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.vaadin.data.Validator |
---|
isValid |
Constructor Detail |
---|
public AbstractValidator(String errorMessage)
errorMessage
- the message to be included in an InvalidValueException
(with "{0}" replaced by the value that failed validation).Method Detail |
---|
public void validate(Object value) throws Validator.InvalidValueException
Validator
Validator.InvalidValueException
is thrown.
validate
in interface Validator
value
- the value to check
Validator.InvalidValueException
- if the value is invalidpublic String getErrorMessage()
setErrorMessage(String)
.public void setErrorMessage(String errorMessage)
errorMessage
- the error message. "{0}" is automatically replaced by the
value that did not validate.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |