Package javax.time.calendar.format
Class DateTimeFormatSymbols
- java.lang.Object
-
- javax.time.calendar.format.DateTimeFormatSymbols
-
public final class DateTimeFormatSymbols extends java.lang.ObjectSymbols used for date and time formatting.
-
-
Field Summary
Fields Modifier and Type Field Description private chardecimalPointCharThe decimal point character.private java.util.LocalelocaleThe locale for printing and parsing text.private charnegativeSignCharThe negative sign character.private charpositiveSignCharThe positive sign character.private charzeroCharThe zero character.
-
Constructor Summary
Constructors Modifier Constructor Description privateDateTimeFormatSymbols(java.util.Locale locale)Constructor.privateDateTimeFormatSymbols(java.util.Locale locale, java.text.DateFormatSymbols oldSymbols)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.lang.StringconvertNumberToI18N(java.lang.String numericText)Converts the input numeric text to the internationalized form using the zero character.intconvertToDigit(char ch)Checks whether the character is a digit, based on the currently set zero character.static java.util.Locale[]getAvailableLocales()Returns an array of all locales for which thegetInstancemethods of this class can return localized instances.chargetDecimalPointChar()Gets the character that represents the decimal point.chargetDigitChar(int digit)Gets the character that represents the specified digit.static DateTimeFormatSymbolsgetInstance()Gets theDateFormatSymbolsinstance for the default locale.static DateTimeFormatSymbolsgetInstance(java.util.Locale locale)Gets theDateFormatSymbolsinstance for the specified locale.java.util.LocalegetLocale()Gets the locale to use for printing and parsing text.chargetNegativeSignChar()Gets the character that represents the negative sign.chargetPositiveSignChar()Gets the character that represents the positive sign.chargetZeroChar()Gets the character that represents zero.
-
-
-
Field Detail
-
locale
private final java.util.Locale locale
The locale for printing and parsing text.
-
zeroChar
private final char zeroChar
The zero character.- See Also:
- Constant Field Values
-
positiveSignChar
private final char positiveSignChar
The positive sign character.- See Also:
- Constant Field Values
-
negativeSignChar
private final char negativeSignChar
The negative sign character.- See Also:
- Constant Field Values
-
decimalPointChar
private final char decimalPointChar
The decimal point character.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DateTimeFormatSymbols
private DateTimeFormatSymbols(java.util.Locale locale)
Constructor.- Parameters:
locale- the locale, not null
-
DateTimeFormatSymbols
private DateTimeFormatSymbols(java.util.Locale locale, java.text.DateFormatSymbols oldSymbols)Constructor.- Parameters:
locale- the locale, not nulloldSymbols- the old symbols, not null
-
-
Method Detail
-
getAvailableLocales
public static java.util.Locale[] getAvailableLocales()
Returns an array of all locales for which thegetInstancemethods of this class can return localized instances. The returned array represents the union of locales supported by the Java runtime and by installedDateTimeFormatSymbolsProviderimplementations. It must contain at least aLocaleinstance equal toLocale.US.- Returns:
- an array of locales for which localized
DateTimeFormatSymbolsinstances are available
-
getInstance
public static DateTimeFormatSymbols getInstance()
Gets theDateFormatSymbolsinstance for the default locale. This method provides access toDateFormatSymbolsinstances for locales supported by the Java runtime itself as well as for those supported by installedDateFormatSymbolsProviderimplementations.- Returns:
- a
DateTimeFormatSymbolsinstance.
-
getInstance
public static DateTimeFormatSymbols getInstance(java.util.Locale locale)
Gets theDateFormatSymbolsinstance for the specified locale. This method provides access toDateFormatSymbolsinstances for locales supported by the Java runtime itself as well as for those supported by installedDateFormatSymbolsProviderimplementations.- Parameters:
locale- the given locale, not null- Returns:
- a
DateTimeFormatSymbolsinstance - Throws:
java.lang.NullPointerException- iflocaleis null
-
getLocale
public java.util.Locale getLocale()
Gets the locale to use for printing and parsing text.The locale information for printing and parsing numbers is defined in the zero, negative and positive characters.
- Returns:
- the character for zero
-
getZeroChar
public char getZeroChar()
Gets the character that represents zero.This character can vary by locale.
- Returns:
- the character for zero
-
getDigitChar
public char getDigitChar(int digit)
Gets the character that represents the specified digit.This character can vary by locale. The characters for one to nine are based on the stored zero character.
- Parameters:
digit- the single digit to convert to a character, from 0 to 9- Returns:
- the character for the digit
-
convertToDigit
public int convertToDigit(char ch)
Checks whether the character is a digit, based on the currently set zero character.- Parameters:
ch- the character to check- Returns:
- the value, 0 to 9, of the character, or -1 if not a digit
-
getPositiveSignChar
public char getPositiveSignChar()
Gets the character that represents the positive sign.This character can vary by locale.
- Returns:
- the character for the positive sign
-
getNegativeSignChar
public char getNegativeSignChar()
Gets the character that represents the negative sign.This character can vary by locale.
- Returns:
- the character for the negative sign
-
getDecimalPointChar
public char getDecimalPointChar()
Gets the character that represents the decimal point.This character can vary by locale.
- Returns:
- the character for the decimal point
-
convertNumberToI18N
java.lang.String convertNumberToI18N(java.lang.String numericText)
Converts the input numeric text to the internationalized form using the zero character.- Parameters:
numericText- the text, consisting of digits 0 to 9, to convert, not null- Returns:
- the internationalized text, never null
-
-