public interface Range<T extends Comparable<T>>
Comparable<T>
. RangeUtils.validateIsInRange(String, Range, Comparable)
,
RangeUtils.validateMinMaxValues(String, Range, Comparable)
Modifier and Type | Method and Description |
---|---|
T |
getMaxValue()
The maximum value (inclusive)
|
T |
getMinValue()
The minimum value (inclusive)
|
boolean |
isUseMaxValue()
If there is a maximum limit.
|
boolean |
isUseMinValue()
If there is a minimum limit.
|
void |
setMaxValue(T maxValue)
Sets the maximum limit (inclusive).
|
void |
setMinValue(T minValue)
Sets the minimum limit (inclusive).
|
void |
validateIsInRange(String propertyName,
T value)
Validates that a value is inside the valid range of min and max value if defined.
|
void |
validateMinMaxValues(String propertyName)
Validates that minValue is less or equal to maxValue, must be called by validateConstraints, and if there is a default value that is inside the valid range.
|
T getMinValue()
null
than no minimum limit.T getMaxValue()
null
than no minimum limit.void setMinValue(T minValue)
minValue
- the minimum limit, if null
than no limit.void setMaxValue(T maxValue)
maxValue
- the maximum limit, if null
than no limit.boolean isUseMinValue()
true
if getMinValue() differs from null
, otherwise false
.boolean isUseMaxValue()
true
if getMaxValue() differs from null
, otherwise false
.void validateMinMaxValues(String propertyName) throws PropertyException
propertyName
- the name of the property.PropertyException
- if minValue is greather than maxValue.PropertyType.validateConstraints(String)
void validateIsInRange(String propertyName, T value) throws PropertyException
propertyName
- the propertyvalue
- the valuePropertyException
- if minValue is not null
and value is less than, or maxValue is not null
and value is greather than.PropertyType.validateValue(String, String)