Class CompiledPattern
java.lang.Object
org.apache.calcite.util.format.postgresql.format.compiled.CompiledPattern
- All Implemented Interfaces:
CompiledItem
- Direct Known Subclasses:
AmPmCompiledPattern,BcAdCompiledPattern,DayOfWeekCompiledPattern,MonthCompiledPattern,NumberCompiledPattern,RomanNumeralsCompiledPattern,TimeZoneCompiledPattern,TimeZoneHoursCompiledPattern,TimeZoneMinutesCompiledPattern,TimeZoneOffsetCompiledPattern,YearWithCommasCompiledPattern
A single date/time format compiled component such as "YYYY" or "MI". A compiled component
is a format component along with any flags it had. Adds the ability to parse a string.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCompiledPattern(ChronoUnitEnum chronoUnit, Set<PatternModifier> modifiers) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract intReturns the length of the format pattern without modifiers.Get the ChronoUnitEnum value that this pattern is for.intReturns the length of the format pattern.booleanDoes this pattern match a sequence of digits.abstract intparseValue(ParsePosition inputPosition, String input, boolean enforceLength, Locale locale) Parse this date/time component from a String.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.calcite.util.format.postgresql.format.compiled.CompiledItem
convertToString
-
Field Details
-
modifiers
-
-
Constructor Details
-
CompiledPattern
-
-
Method Details
-
getChronoUnit
Get the ChronoUnitEnum value that this pattern is for.- Returns:
- a ChronoUnitEnum value
-
parseValue
public abstract int parseValue(ParsePosition inputPosition, String input, boolean enforceLength, Locale locale) throws ParseException Parse this date/time component from a String.- 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
-
getFormatPatternLength
public int getFormatPatternLength()Description copied from interface:CompiledItemReturns the length of the format pattern.- Specified by:
getFormatPatternLengthin interfaceCompiledItem- Returns:
- length of the format pattern
-
getBaseFormatPatternLength
protected abstract int getBaseFormatPatternLength()Returns the length of the format pattern without modifiers.- Returns:
- length of the format pattern
-
isNumeric
public boolean isNumeric()Does this pattern match a sequence of digits.- Returns:
- true if this pattern matches a sequence of digits
-