public class DateFormatParser
extends java.lang.Object
parse(String)
method is responsible for checking the
Progress date format validity.
Also this class provides a set of callback methods,
each callback is called when the corresponding format component is parsed.
By default, all callbacks do nothing, they are expected to be re-defined in subclasses.Constructor and Description |
---|
DateFormatParser() |
Modifier and Type | Method and Description |
---|---|
private static void |
genDateFormatIncomleteError(java.lang.String fmt)
Record or throw the error number 154.
|
void |
parse(java.lang.String format)
Parse date format, call callbacks while parsing.
|
protected void |
visitDateComponent(int componentIndex,
int startIdx,
int endIdx)
Dispatch the date component to a matching callback.
|
protected void |
visitSep1(char sep)
The first date component separator was parsed: one of '.', '-' or '/'.
|
protected void |
visitSep2(char sep)
The second date component separator was parsed: one of '.', '-' or '/'.
|
protected void visitSep1(char sep)
Subclasses are expected to overload this method, default implementation does nothing.
Note: if date format has no separators, this callback is never called.
sep
- the first separator characterprotected void visitSep2(char sep)
Subclasses are expected to overload this method, default implementation does nothing.
Note: if date format has no separators, this callback is never called.
sep
- the second separator characterprotected void visitDateComponent(int componentIndex, int startIdx, int endIdx)
componentIndex
- the number of the component in the format specstartIdx
- the component start index, zero basedendIdx
- the component end index, zero based, exclusivepublic void parse(java.lang.String format) throws ErrorConditionException
format
- the format to parseErrorConditionException
- in case the date format is invalidprivate static final void genDateFormatIncomleteError(java.lang.String fmt)
fmt
- the problematic format string