java.lang.Object
org.apache.calcite.util.format.postgresql.format.FormatPattern
Direct Known Subclasses:
AmPmFormatPattern, BcAdFormatPattern, DayOfWeekFormatPattern, MonthFormatPattern, NumberFormatPattern, RomanNumeralsFormatPattern, TimeZoneFormatPattern, TimeZoneHoursFormatPattern, TimeZoneMinutesFormatPattern, TimeZoneOffsetFormatPattern, YearWithCommasFormatPattern

public abstract class FormatPattern extends Object
A single component of a date/time format pattern such as YYYY or MI. Each component may have some flags applied. If the flags are not used by a component, then they are ignored.
  • Field Details

    • pattern

      protected final String pattern
  • Constructor Details

    • FormatPattern

      protected FormatPattern(String pattern)
      Base class constructor that stores the pattern.
      Parameters:
      pattern - the date/time component taht this FormatPattern represents
  • Method Details

    • compilePattern

      public CompiledPattern compilePattern(String formatString, ParsePosition formatParsePosition) throws ParseException
      Creates the compiled version of the parsed date/time component along with any flags that it had. It is expected that the formatString has the date/time component (with its flags) at the position indicated in formatParsePosition.
      Parameters:
      formatString - the full date/time format string
      formatParsePosition - starting position in formatString with this pattern is located
      Returns:
      the compiled version of the parsed date/time component
      Throws:
      ParseException - If the date/time format component was not found
    • buildCompiledPattern

      protected abstract CompiledPattern buildCompiledPattern(Set<PatternModifier> modifiers)
      Creates a new instance of the compiled version of this date/time component.
      Parameters:
      modifiers - the set of flags that were parsed
      Returns:
      a new instance of the compiled version of this date/time component
    • getPattern

      public String getPattern()