Class ToDateTokenizer
java.lang.Object
org.h2.mode.ToDateTokenizer
Emulates Oracle's TO_DATE function. This class knows all about the
TO_DATE-format conventions and how to parse the corresponding data.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classParslet responsible for parsing day parameterstatic enumThe format tokens.(package private) static classParslet responsible for parsing year parameter(package private) static classParslet responsible for parsing month parameter(package private) static classParslet responsible for parsing time parameter(package private) static interfaceInterface of the classes that can parse a specialized small bit of the TO_DATE format-string.(package private) static classParslet responsible for parsing year parameter -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final ToDateTokenizer.DayParsletThe parslet for a day.(package private) static final ToDateTokenizer.InlineParsletThe inline parslet.(package private) static final ToDateTokenizer.MonthParsletThe parslet for a month.(package private) static final ToDateTokenizer.TimeParsletThe parslet for time.(package private) static final ToDateTokenizer.YearParsletThe parslet for a year.(package private) static final PatternThe pattern for "am" or "pm".(package private) static final PatternThe pattern for "bc" or "ad".(package private) static final PatternThe pattern for a fraction (of a second for example).(package private) static final PatternThe pattern for four digits (typically a year).(package private) static final PatternThe pattern for a number.(package private) static final PatternThe pattern for a number.(package private) static final PatternThe pattern for one digit.(package private) static final PatternThe pattern for three digits.(package private) static final PatternThe pattern for two digits.(package private) static final PatternThe pattern for one or two digits.(package private) static final PatternThe pattern 2-4 digits (e.g. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static StringmatchStringOrThrow(Pattern p, ToDateParser params, Enum<?> aEnum) Match the pattern, or if not possible throw an exception.(package private) static StringsetByName(ToDateParser params, int field) Set the given field in the calendar.(package private) static voidthrowException(ToDateParser params, String errorStr) Throw a parse exception.
-
Field Details
-
PATTERN_INLINE
The pattern for a number. -
PATTERN_NUMBER
The pattern for a number. -
PATTERN_FOUR_DIGITS
The pattern for four digits (typically a year). -
PATTERN_TWO_TO_FOUR_DIGITS
The pattern 2-4 digits (e.g. for RRRR). -
PATTERN_THREE_DIGITS
The pattern for three digits. -
PATTERN_TWO_DIGITS
The pattern for two digits. -
PATTERN_TWO_DIGITS_OR_LESS
The pattern for one or two digits. -
PATTERN_ONE_DIGIT
The pattern for one digit. -
PATTERN_FF
The pattern for a fraction (of a second for example). -
PATTERN_AM_PM
The pattern for "am" or "pm". -
PATTERN_BC_AD
The pattern for "bc" or "ad". -
PARSLET_YEAR
The parslet for a year. -
PARSLET_MONTH
The parslet for a month. -
PARSLET_DAY
The parslet for a day. -
PARSLET_TIME
The parslet for time. -
PARSLET_INLINE
The inline parslet. E.g. 'YYYY-MM-DD"T"HH24:MI:SS"Z"' where "T" and "Z" are inlined
-
-
Constructor Details
-
ToDateTokenizer
private ToDateTokenizer()
-
-
Method Details
-
matchStringOrThrow
Match the pattern, or if not possible throw an exception.- Parameters:
p- the patternparams- the parameters with the input stringaEnum- the pattern name- Returns:
- the matched value
-
setByName
Set the given field in the calendar.- Parameters:
params- the parameters with the input stringfield- the field to set- Returns:
- the matched value
-
throwException
Throw a parse exception.- Parameters:
params- the parameters with the input stringerrorStr- the error string
-