public class RangeUtils extends Object
Constructor and Description |
---|
RangeUtils() |
Modifier and Type | Method and Description |
---|---|
static <T extends Comparable<T>> |
getMinMaxValueDescription(Range<T> range)
Genereates range descriptions to be added to string list restrictions.
|
static <T extends Comparable<T>> |
validateIsInRange(String propertyName,
Range<T> range,
T value)
Validates that a given value T is inside the range defined.
|
static <T extends Comparable<T>> |
validateMinMaxValues(String propertyName,
Range<T> range,
T defaultValue)
Validates the range settings called by validateConstraints method in the PropertyType.
|
public static <T extends Comparable<T>> void validateMinMaxValues(String propertyName, Range<T> range, T defaultValue) throws PropertyException
propertyName
- the name of the propertyType.range
- the Range instance.defaultValue
- the default value if any.PropertyException
- if both min and max value has a value (!=null) and minValue is greather than maxValue or if defaultValue is set (!=null) that the defaultValue is outside the range.PropertyType.validateConstraints(String)
public static <T extends Comparable<T>> void validateIsInRange(String propertyName, Range<T> range, T value) throws PropertyException
propertyName
- the name of the propertyType.range
- the Range instance.value
- the value T.PropertyException
- if the value T not inside the valid Range.PropertyType.validateValue(String, String)
public static <T extends Comparable<T>> List<String> getMinMaxValueDescription(Range<T> range)
range
- the Range instance.PropertyType.getRestrictions()