IllegalValue
Constructor and Description |
---|
StringRange() |
StringRange(java.util.Collection<java.lang.String> valid) |
StringRange(java.lang.String... valid) |
Modifier and Type | Method and Description |
---|---|
StringRange |
clone() |
java.lang.String[] |
getValidStrings() |
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.
|
boolean |
isWildcard() |
static void |
main(java.lang.String[] args) |
java.lang.Object |
makeValid(java.lang.Object obj)
Projects an object to lie within the range allowed by this Range, if
possible.
|
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
java.lang.String |
toString() |
void |
write(java.io.PrintWriter pw,
NumberFormat fmt,
java.lang.Object ref)
Writes a text description of this element to a PrintWriter.
|
isWritable, setError
public StringRange()
public StringRange(java.util.Collection<java.lang.String> valid)
public StringRange(java.lang.String... valid)
public java.lang.String[] getValidStrings()
public boolean isWildcard()
public boolean isValid(java.lang.Object obj, StringHolder errMsg)
RangeBase
errMsg
is not null
, then errMsg.value
should
be set to a message describing why the object is not valid.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object makeValid(java.lang.Object obj)
RangeBase
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, Range.IllegalValue
should be returned.
In particular, projectToRange(obj) != obj
should
be a valid indication that the obj
is not within range.
public boolean isEmpty()
RangeBase
public void intersect(Range r)
RangeBase
Range.isEmpty()
should subsequently return true
.public void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
RangeBase
write
.public void write(java.io.PrintWriter pw, NumberFormat fmt, java.lang.Object ref) throws java.io.IOException
RangeBase
scan
and complete
enough to allow full reconstruction of the element.write
in interface Scannable
write
in class RangeBase
pw
- stream for writing the elementfmt
- numeric formating informationref
- optional reference object which can be used for producing references to
other objectsjava.io.IOException
- if an I/O error occuredpublic StringRange clone()
public static void main(java.lang.String[] args)