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

public abstract class CompiledPattern extends Object implements CompiledItem
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 Details

  • Constructor Details

  • Method Details

    • getChronoUnit

      public ChronoUnitEnum 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 parsing
      input - full string that will be parsed
      enforceLength - 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: CompiledItem
      Returns the length of the format pattern.
      Specified by:
      getFormatPatternLength in interface CompiledItem
      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