Interface PeriodFormatterBuilder.PeriodFieldAffix

All Known Implementing Classes:
PeriodFormatterBuilder.CompositeAffix, PeriodFormatterBuilder.IgnorableAffix, PeriodFormatterBuilder.PluralAffix, PeriodFormatterBuilder.RegExAffix, PeriodFormatterBuilder.SimpleAffix
Enclosing class:
PeriodFormatterBuilder

static interface PeriodFormatterBuilder.PeriodFieldAffix
Defines a formatted field's prefix or suffix text. This can be used for fields such as 'n hours' or 'nH' or 'Hour:n'.
  • Method Details

    • calculatePrintedLength

      int calculatePrintedLength(int value)
    • printTo

      void printTo(StringBuffer buf, int value)
    • printTo

      void printTo(Writer out, int value) throws IOException
      Throws:
      IOException
    • parse

      int parse(String periodStr, int position)
      Parameters:
      periodStr - the period
      position - the position
      Returns:
      new position after parsing affix, or ~position of failure
    • scan

      int scan(String periodStr, int position)
      Parameters:
      periodStr - the period
      position - the position
      Returns:
      position where affix starts, or original ~position if not found
    • getAffixes

      String[] getAffixes()
      Returns:
      a copy of array of affixes
    • finish

      void finish(Set<PeriodFormatterBuilder.PeriodFieldAffix> affixesToIgnore)
      This method should be called only once. After first call consecutive calls to this methods will have no effect. Causes this affix to ignore a match (parse and scan methods) if there is an affix in the passed list that holds affix text which satisfy both following conditions: - the affix text is also a match - the affix text is longer than the match from this object
      Parameters:
      affixesToIgnore - the affixes that should be ignored