javax.time.calendar.format
Class SimpleDateTimeTextProvider

java.lang.Object
  extended by java.util.spi.LocaleServiceProvider
      extended by javax.time.calendar.format.DateTimeTextProvider
          extended by javax.time.calendar.format.SimpleDateTimeTextProvider

public final class SimpleDateTimeTextProvider
extends DateTimeTextProvider

The Service Provider Implementation to obtain date-time text for a rule.

This implementation is based on extraction of data from a DateFormatSymbols.

This class is thread-safe.

Author:
Stephen Colebourne

Constructor Summary
SimpleDateTimeTextProvider()
           
 
Method Summary
 java.util.Locale[] getAvailableLocales()
          
 java.lang.String getText(DateTimeField field, TextStyle style, java.util.Locale locale)
          Gets the text for the specified field, locale and style for the purpose of printing.
 java.util.Iterator<java.util.Map.Entry<java.lang.String,DateTimeField>> getTextIterator(DateTimeRule rule, TextStyle style, java.util.Locale locale)
          Gets an iterator of text to field for the specified rule, locale and style for the purpose of parsing.
 
Methods inherited from class javax.time.calendar.format.DateTimeTextProvider
createEntry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDateTimeTextProvider

public SimpleDateTimeTextProvider()
Method Detail

getAvailableLocales

public java.util.Locale[] getAvailableLocales()

Specified by:
getAvailableLocales in class java.util.spi.LocaleServiceProvider

getText

public java.lang.String getText(DateTimeField field,
                                TextStyle style,
                                java.util.Locale locale)
Description copied from class: DateTimeTextProvider
Gets the text for the specified field, locale and style for the purpose of printing.

The text associated with the value is returned. The null return value should be used if there is no applicable text, or if the text would be a numeric representation of the value.

Specified by:
getText in class DateTimeTextProvider
Parameters:
field - the field to get text for, not null
style - the style to get text for, not null
locale - the locale to get text for, not null
Returns:
the text for the field value, null if no text found

getTextIterator

public java.util.Iterator<java.util.Map.Entry<java.lang.String,DateTimeField>> getTextIterator(DateTimeRule rule,
                                                                                               TextStyle style,
                                                                                               java.util.Locale locale)
Description copied from class: DateTimeTextProvider
Gets an iterator of text to field for the specified rule, locale and style for the purpose of parsing.

The iterator must be returned in order from the longest text to the shortest.

The null return value should be used if there is no applicable parsable text, or if the text would be a numeric representation of the value. Text can only be parsed if all the values for that rule-style-locale combination are unique.

Specified by:
getTextIterator in class DateTimeTextProvider
Parameters:
rule - the rule to get text for, not null
style - the style to get text for, null for all parsable text
locale - the locale to get text for, not null
Returns:
the iterator of text to field pairs, in order from longest text to shortest text, null if the rule or style is not parsable