V - is the generic type of the contained values.public class Range<V> extends Object implements Serializable, AttributeReadMinimumValue<V>, AttributeReadMaximumValue<V>
minimum and maximum.
Validation is performed at construction so a given Range should
always be valid (unless created via reflection or de-serialization). minimum and maximum value may
be null for unbounded ranges. It is still recommended to use fixed bounds such as
Long.MAX_VALUE. However, for types such as BigDecimal this is not possible.| Modifier and Type | Field and Description |
|---|---|
private V |
max |
static String |
MAX_UNBOUND
The unbound maximum.
|
private V |
min |
static String |
MIN_UNBOUND
The unbound minimum.
|
private static long |
serialVersionUID |
| Modifier | Constructor and Description |
|---|---|
protected |
Range()
The constructor for serialization.
|
|
Range(V min,
V max)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected Comparator<? super V> |
getComparator() |
V |
getMax()
Shorthand form for
getMaximumValue(). |
V |
getMaximumValue()
This method gets the maximum
value of this object. |
V |
getMin()
Shorthand form for
getMinimumValue(). |
V |
getMinimumValue()
This method gets the minimum
value of this object. |
boolean |
isContained(V value)
|
String |
toString() |
void |
verifyContained(V value)
This method verifies that the given
value is contained in this range
. |
private static final long serialVersionUID
private V min
private V max
public static final String MIN_UNBOUND
public static final String MAX_UNBOUND
public V getMin()
getMinimumValue().null and NOT be less than max.public V getMax()
getMaximumValue().null and NOT be greater than min.public V getMinimumValue()
value of this object. A legal value has
to be greater or equal to this minimum.getMinimumValue in interface AttributeReadMinimumValue<V>value or
null if unbounded.getMin()public V getMaximumValue()
value of this object. A legal value has
to be less or equal to this maximum.getMaximumValue in interface AttributeReadMaximumValue<V>value or
null if unbounded.getMax()protected Comparator<? super V> getComparator()
Comparator used to compare values of this
Range. The default implementation assumes that the value type implements
Comparable. If you want to use other value types you need to create a sub-class of
Range and override this method.public boolean isContained(V value)
public void verifyContained(V value) throws ValueOutOfRangeException
value is contained in this range
.value - is the value to check.ValueOutOfRangeException - if not contained.ValueOutOfRangeExceptionCopyright © 2001–2016 mmm-Team. All rights reserved.