market
Class VCPositiveInteger
java.lang.Object
|
+--market.VCPositiveInteger
- All Implemented Interfaces:
- Serializable, ValueChecker
- public class VCPositiveInteger
- extends Object
- implements ValueChecker
A ValueChecker, which checks if a String is in the format of an Integer (e.g. 1500).
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.
VCPositiveInteger
public VCPositiveInteger(String identifier,
boolean mayBeEmpty)
- Parameters:
identifier - the identifier.mayBeEmpty - true if an empty should be considered valid, otherwise false.
VCPositiveInteger
public VCPositiveInteger(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 an Integer, otherwise false.
getErrorString
public String getErrorString()
- Specified by:
getErrorString in interface ValueChecker
- Returns:
- an error message depending on the value of
#error.