Class AmPmCompiledPattern
java.lang.Object
org.apache.calcite.util.format.postgresql.format.compiled.CompiledPattern
org.apache.calcite.util.format.postgresql.format.compiled.AmPmCompiledPattern
- All Implemented Interfaces:
CompiledItem
The date/time format compiled component for AM/PM (first or second half of day).
-
Field Summary
Fields inherited from class org.apache.calcite.util.format.postgresql.format.compiled.CompiledPattern
modifiers
-
Constructor Summary
ConstructorDescriptionAmPmCompiledPattern
(Set<PatternModifier> modifiers, boolean upperCase, boolean includePeriods) -
Method Summary
Modifier and TypeMethodDescriptionconvertToString
(ZonedDateTime dateTime, Locale locale) Creates one portion of the formatted date/time.protected int
Returns the length of the format pattern without modifiers.int
parseValue
(ParsePosition inputPosition, String input, boolean enforceLength, Locale locale) Parse this date/time component from a String.Methods inherited from class org.apache.calcite.util.format.postgresql.format.compiled.CompiledPattern
getChronoUnit, getFormatPatternLength, isNumeric
-
Constructor Details
-
AmPmCompiledPattern
public AmPmCompiledPattern(Set<PatternModifier> modifiers, boolean upperCase, boolean includePeriods)
-
-
Method Details
-
convertToString
Description copied from interface:CompiledItem
Creates one portion of the formatted date/time.- Parameters:
dateTime
- date/time value to formatlocale
- Locale to use for day or month names if the TM modifier was present- Returns:
- the formatted String value of this date/time component
-
parseValue
public int parseValue(ParsePosition inputPosition, String input, boolean enforceLength, Locale locale) throws ParseException Description copied from class:CompiledPattern
Parse this date/time component from a String.- Specified by:
parseValue
in classCompiledPattern
- Parameters:
inputPosition
- starting position for parsinginput
- full string that will be parsedenforceLength
- whether to limit the length of characters read. Needed when one sequence of digits is followed by another (such as YYYYDD).locale
- Locale to use for parsing day and month names if the TM flag was present- Returns:
- the integer value of the parsed date/time component
- Throws:
ParseException
- if unable to parse a value from input
-
getBaseFormatPatternLength
protected int getBaseFormatPatternLength()Description copied from class:CompiledPattern
Returns the length of the format pattern without modifiers.- Specified by:
getBaseFormatPatternLength
in classCompiledPattern
- Returns:
- length of the format pattern
-