market
Class VCPositiveDouble
java.lang.Object
|
+--market.VCPositiveDouble
- All Implemented Interfaces:
- Serializable, ValueChecker
- public class VCPositiveDouble
- extends Object
- implements ValueChecker
A ValueChecker, which checks if a String is in the format of a Double (e.g. 15.256).
Notations like 15,256 are also allowed. The number must not be negative.
As this ValueChecker is only used by checkable text fields
,
an identifier is passed via the constructor. This descriptive identifier is used in the error string,
to enable the user to associate an error message with the causative text field.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
identifier
protected String identifier
- The identifier used by
getErrorString()
.
mayBeEmpty
protected boolean mayBeEmpty
- Defines if an empty String is considered to be an error or not.
VCPositiveDouble
public VCPositiveDouble(String identifier,
boolean mayBeEmpty)
- Parameters:
identifier
- the identifier.mayBeEmpty
- true
if an empty should be considered valid, otherwise false
.
VCPositiveDouble
public VCPositiveDouble(String identifier)
- Parameters:
identifier
- the identifier.
isValidValue
public boolean isValidValue(String content)
- Checks String for validity and, if necessary, sets an internal error code according to the
detected error.
- Specified by:
isValidValue
in interface ValueChecker
- Parameters:
content
- the String to be checked.
- Returns:
true
if the String represents a Double, otherwise false
.
getErrorString
public String getErrorString()
- Specified by:
getErrorString
in interface ValueChecker
- Returns:
- an error message depending on the value of
#error
.