Großmarkt

market
Class VCDate

java.lang.Object
  |
  +--market.VCDate
All Implemented Interfaces:
Serializable, ValueChecker

public class VCDate
extends Object
implements ValueChecker

A ValueChecker, which checks if a String is in the format dd.MM.yyyy (e.g. 01.01.2000).
Notations like 1.1.2000 are also not allowed.

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

Field Summary
protected  String identifier
          The identifier used by getErrorString().
protected  boolean mayBeEmpty
          Defines if an empty String is considered to be an error or not.
 
Constructor Summary
VCDate(String identifier)
           
VCDate(String identifier, boolean mayBeEmpty)
           
 
Method Summary
 String getErrorString()
           
 boolean isValidValue(String content)
          Checks String for validity and, if necessary, sets an internal error code according to the detected error.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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.

Constructor Detail

VCDate

public VCDate(String identifier,
              boolean mayBeEmpty)
Parameters:
identifier - the identifier.
mayBeEmpty - true if an empty should be considered valid, otherwise false.

VCDate

public VCDate(String identifier)
Parameters:
identifier - the identifier.
Method Detail

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 is in a valid date format, otherwise false.

getErrorString

public String getErrorString()
Specified by:
getErrorString in interface ValueChecker
Returns:
an error message depending on the value of #error.

Großmarkt