public class NullValidator extends Object implements Validator
Validator.EmptyValueException, Validator.InvalidValueException
Constructor and Description |
---|
NullValidator(String errorMessage,
boolean onlyNullAllowed)
Creates a new NullValidator.
|
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 otherwise
false . |
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.
|
public NullValidator(String errorMessage, boolean onlyNullAllowed)
errorMessage
- the error message to display on invalidation.onlyNullAllowed
- Are only nulls allowed?public void validate(Object value) throws Validator.InvalidValueException
public final boolean isNullAllowed()
true
if nulls are allowed otherwise
false
.public void setNullAllowed(boolean onlyNullAllowed)
onlyNullAllowed
- If true, only nulls are allowed. If false only non-nulls are
allowed. Do we allow nulls?public String getErrorMessage()
public void setErrorMessage(String errorMessage)
errorMessage
- the Error Message to set.Copyright © 2019 Vaadin Ltd. All rights reserved.