Class DurationFormatPattern

  • public class DurationFormatPattern
    extends java.lang.Object
    Class implementing the Format pattern for a duration format partly using Joda PeriodFormatter.
    Christopher Mindus
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static java.text.FormatgetPeriodFormatter​(java.lang.String pattern, LocaleInfo localeInfo)
      Gets the Joda period formatter for a pattern.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DurationFormatPattern

        public DurationFormatPattern()
    • Method Detail

      • getPeriodFormatter

        public static java.text.Format getPeriodFormatter​(java.lang.String pattern,
                                                          LocaleInfo localeInfo)
        Gets the Joda period formatter for a pattern. This formatter does not implement the Format interface unlike the others.

        When using a formatter, the duration is converted to or from a standard period that makes the assumption that all weeks are 7 days, all days are 24 hours, all hours are 60 minutes and all minutes are 60 seconds. This is not true when daylight savings time is considered, and may also not be true for some unusual chronologies. However, it is included as it is a useful operation for many applications and business rules.

        pattern - The pattern for the formatter. If the pattern is null, null is returned as the formatter because the duration should be formatted as duration.toString().
        localeInfo - The locale information or null for default locale.

        Available languages are English, Danish, Dutch, French, German, Japanese, Portuguese, and Spanish and Swedish.

        The formatter.
        java.lang.IllegalArgumentException - If the pattern is not valid.