public interface Range extends Scannable, Clonable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.Class<?> |
IllegalValue
Special object to indicate an illegal value,
|
| Modifier and Type | Method and Description |
|---|---|
void |
intersect(Range r)
Intersects the set of valid values of this Range with those of
another.
|
boolean |
isEmpty()
Returns true if this range is empty - i.e., if there are no valid
values.
|
boolean |
isValid(java.lang.Object obj,
StringHolder errMsg)
Returns true if the specified object is valid for this Range,
and false otherwise.
|
java.lang.Object |
makeValid(java.lang.Object obj)
Projects an object to lie within the range allowed by this Range, if
possible.
|
isWritable, scan, writestatic final java.lang.Class<?> IllegalValue
boolean isValid(java.lang.Object obj,
StringHolder errMsg)
errMsg
is not null, then errMsg.value should
be set to a message describing why the object is not valid.obj - Object to be testeserrMsg - Optional handle for storing error messagejava.lang.Object makeValid(java.lang.Object obj)
obj is already within the range, then
obj should be returned unchanged. Otherwise, if it can be
projected to the range, then a new (projected) object should be
returned. Otherwise, if it cannot be projected, IllegalValue
should be returned.
In particular, projectToRange(obj) != obj should
be a valid indication that the obj is not within range.
obj - object to be projectednull.boolean isEmpty()