|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.parameters.validation.NumberValidator<E>
E
- That subclass of Number
to validatepublic class NumberValidator<E extends Comparable<? extends Number>>
Class that validates all subclasses of Number
that implement Comparable
(e.g. Double, Long, Float
)
for compliance with a specified lower and upper bound.
Constructor Summary | |
---|---|
NumberValidator(E lowerBound,
E upperBound)
Constructs a NumberValidator for a given upper and lower bound. |
|
NumberValidator(StringBuffer representation)
Constructs a NumberValidator out of a XML representation |
Method Summary | |
---|---|
boolean |
checkValue(Object value)
Returns true if the value is valid and false otherwise |
NumberValidator |
clone()
This method returns a deep copy of the current instance. |
void |
fromXML(StringBuffer representation)
Parses a NumberValidator from the XML-representation
as returned by toXML() . |
String |
getErrorMessage()
Returns the error message if checkValue() returned false. |
E |
getLowerBound()
Returns the lower bound of the NumberValidator |
StringBuffer |
toXML()
This method returns an XML-representation of an instance of the implementing class. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NumberValidator(E lowerBound, E upperBound)
NumberValidator
for a given upper and lower bound.
lowerBound
- the lower boundupperBound
- the upper boundpublic NumberValidator(StringBuffer representation) throws NonParsableException
representation
- the XML representation
NonParsableException
- is the representation could not be parsed, a NonParsableException
is thrownMethod Detail |
---|
public NumberValidator clone()
ParameterValidator
clone
in interface ParameterValidator
clone
in class Object
Cloneable
public E getLowerBound()
public String getErrorMessage()
ParameterValidator
checkValue()
returned false.
getErrorMessage
in interface ParameterValidator
public boolean checkValue(Object value)
ParameterValidator
true
if the value is valid and false
otherwise
checkValue
in interface ParameterValidator
value
- the value to check
public void fromXML(StringBuffer representation) throws NonParsableException
NumberValidator
from the XML-representation
as returned by toXML()
.
representation
- the XML-representation
NonParsableException
- thrown if the XML-code could not be parsedpublic StringBuffer toXML()
Storable
toXML
in interface Storable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |