Class PeriodFormatterBuilder.RegExAffix

java.lang.Object
org.joda.time.format.PeriodFormatterBuilder.IgnorableAffix
org.joda.time.format.PeriodFormatterBuilder.RegExAffix
All Implemented Interfaces:
PeriodFormatterBuilder.PeriodFieldAffix
Enclosing class:
PeriodFormatterBuilder

static class PeriodFormatterBuilder.RegExAffix extends PeriodFormatterBuilder.IgnorableAffix
Implements an affix where the text varies by the amount of the field. Different amounts are supported based on the provided parameters.
  • Field Details

    • LENGTH_DESC_COMPARATOR

      private static final Comparator<String> LENGTH_DESC_COMPARATOR
    • iSuffixes

      private final String[] iSuffixes
    • iPatterns

      private final Pattern[] iPatterns
    • iSuffixesSortedDescByLength

      private final String[] iSuffixesSortedDescByLength
  • Constructor Details

  • Method Details

    • selectSuffixIndex

      private int selectSuffixIndex(int value)
    • calculatePrintedLength

      public int calculatePrintedLength(int value)
    • printTo

      public void printTo(StringBuffer buf, int value)
    • printTo

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

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

      public 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

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