org.joda.time.format
Class PeriodFormat

java.lang.Object
  extended by org.joda.time.format.PeriodFormat

public class PeriodFormat
extends Object

Factory that creates instances of PeriodFormatter.

Period formatting is performed by the PeriodFormatter class. Three classes provide factory methods to create formatters, and this is one. The others are ISOPeriodFormat and PeriodFormatterBuilder.

PeriodFormat is thread-safe and immutable, and the formatters it returns are as well.

Since:
1.0
Author:
Brian S O'Neill
See Also:
ISOPeriodFormat, PeriodFormatterBuilder

Constructor Summary
protected PeriodFormat()
          Constructor.
 
Method Summary
static PeriodFormatter getDefault()
          Gets the default formatter that outputs words in English.
static PeriodFormatter wordBased()
          Returns a word based formatter for the JDK default locale.
static PeriodFormatter wordBased(Locale locale)
          Returns a word based formatter for the specified locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeriodFormat

protected PeriodFormat()
Constructor.

Since:
1.1 (previously private)
Method Detail

getDefault

public static PeriodFormatter getDefault()
Gets the default formatter that outputs words in English.

This calls wordBased(Locale) using a locale of ENGLISH.

Returns:
the formatter, not null

wordBased

public static PeriodFormatter wordBased()
Returns a word based formatter for the JDK default locale.

This calls wordBased(Locale) using the default locale.

Returns:
the formatter, not null
Since:
2.0

wordBased

public static PeriodFormatter wordBased(Locale locale)
Returns a word based formatter for the specified locale.

The words are configured in a resource bundle text file - org.joda.time.format.messages. This can be added to via the normal classpath resource bundle mechanisms.

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

Returns:
the formatter, not null
Since:
2.0


Copyright © 2002-2012 Joda.org. All Rights Reserved.