T - The type of Number to validate. Must implement Comparable so that
minimum and maximum checks work.@Deprecated public class RangeValidator<T extends Comparable> extends AbstractValidator<T>
Comparable.
Verifies that the value is of the given type and within the (optionally)
given limits. Typically you want to use a sub class of this like
IntegerRangeValidator, DoubleRangeValidator or
DateRangeValidator in applications.
Note that RangeValidator always accept null values. Make a field
required to ensure that no empty values are accepted or override
isValidValue(Comparable).
Validator.EmptyValueException, Validator.InvalidValueException| Constructor and Description |
|---|
RangeValidator(String errorMessage,
Class<T> type,
T minValue,
T maxValue)
Deprecated.
Creates a new range validator of the given type.
|
| Modifier and Type | Method and Description |
|---|---|
T |
getMaxValue()
Deprecated.
Gets the maximum value of the range.
|
T |
getMinValue()
Deprecated.
Gets the minimum value of the range.
|
Class<T> |
getType()
Deprecated.
|
boolean |
isMaxValueIncluded()
Deprecated.
Checks if the maximum value is part of the accepted range.
|
boolean |
isMinValueIncluded()
Deprecated.
Checks if the minimum value is part of the accepted range.
|
protected boolean |
isValidValue(T value)
Deprecated.
Internally check the validity of a value.
|
void |
setMaxValue(T maxValue)
Deprecated.
Sets the maximum value of the range.
|
void |
setMaxValueIncluded(boolean maxValueIncluded)
Deprecated.
Sets if the maximum value is part of the accepted range.
|
void |
setMinValue(T minValue)
Deprecated.
Sets the minimum value of the range.
|
void |
setMinValueIncluded(boolean minValueIncluded)
Deprecated.
Sets if the minimum value is part of the accepted range.
|
getErrorMessage, isValid, isValidType, setErrorMessage, validatepublic RangeValidator(String errorMessage, Class<T> type, T minValue, T maxValue)
errorMessage - The error message to use if validation failstype - The type of object the validator can validate.minValue - The minimum value that should be accepted or null for no limitmaxValue - The maximum value that should be accepted or null for no limitpublic boolean isMinValueIncluded()
public void setMinValueIncluded(boolean minValueIncluded)
minValueIncluded - true if the minimum value should be part of the range, false
otherwisepublic boolean isMaxValueIncluded()
public void setMaxValueIncluded(boolean maxValueIncluded)
maxValueIncluded - true if the maximum value should be part of the range, false
otherwisepublic T getMinValue()
public void setMinValue(T minValue)
setMinValueIncluded(boolean) to control whether this value is
part of the range or not.minValue - the minimum valuepublic T getMaxValue()
public void setMaxValue(T maxValue)
setMaxValueIncluded(boolean) to control whether this value is
part of the range or not.maxValue - the maximum valueprotected boolean isValidValue(T value)
AbstractValidatorAbstractValidator.validate(Object) and the return value of this method is ignored.
This method should not be called from outside the validator class itself.isValidValue in class AbstractValidator<T extends Comparable>public Class<T> getType()
getType in class AbstractValidator<T extends Comparable>Copyright © 2019 Vaadin Ltd. All rights reserved.