com.vaadin.data.validator.
Class NullValidator
- java.lang.Object
-
- com.vaadin.data.validator.NullValidator
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.data.Validator
Validator.EmptyValueException, Validator.InvalidValueException
-
-
Constructor Summary
Constructors Constructor and Description NullValidator(String errorMessage, boolean onlyNullAllowed)
Creates a new NullValidator.
-
Method Summary
All Methods Modifier and Type Method and Description String
getErrorMessage()
Gets the error message that is displayed in case the value is invalid.
boolean
isNullAllowed()
Returns
true
if nulls are allowed otherwisefalse
.void
setErrorMessage(String errorMessage)
Sets the error message to be displayed on invalid value.
void
setNullAllowed(boolean onlyNullAllowed)
Sets if nulls (and only nulls) are to be allowed.
void
validate(Object value)
Validates the data given in value.
-
-
-
Constructor Detail
-
NullValidator
public NullValidator(String errorMessage, boolean onlyNullAllowed)
Creates a new NullValidator.
Parameters:
errorMessage
- the error message to display on invalidation.onlyNullAllowed
- Are only nulls allowed?
-
-
Method Detail
-
validate
public void validate(Object value) throws Validator.InvalidValueException
Validates the data given in value.
-
isNullAllowed
public final boolean isNullAllowed()
Returns
true
if nulls are allowed otherwisefalse
.
-
setNullAllowed
public void setNullAllowed(boolean onlyNullAllowed)
Sets if nulls (and only nulls) are to be allowed.
Parameters:
onlyNullAllowed
- If true, only nulls are allowed. If false only non-nulls are allowed. Do we allow nulls?
-
getErrorMessage
public String getErrorMessage()
Gets the error message that is displayed in case the value is invalid.
Returns:
the Error Message.
-
setErrorMessage
public void setErrorMessage(String errorMessage)
Sets the error message to be displayed on invalid value.
Parameters:
errorMessage
- the Error Message to set.
-
-