Package javax.time.calendar.format
Class DateTimeFormatSymbols
java.lang.Object
javax.time.calendar.format.DateTimeFormatSymbols
Symbols used for date and time formatting.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final char
The decimal point character.private final Locale
The locale for printing and parsing text.private final char
The negative sign character.private final char
The positive sign character.private final char
The zero character. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
DateTimeFormatSymbols
(Locale locale) Constructor.private
DateTimeFormatSymbols
(Locale locale, DateFormatSymbols oldSymbols) Constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) String
convertNumberToI18N
(String numericText) Converts the input numeric text to the internationalized form using the zero character.int
convertToDigit
(char ch) Checks whether the character is a digit, based on the currently set zero character.static Locale[]
Returns an array of all locales for which thegetInstance
methods of this class can return localized instances.char
Gets the character that represents the decimal point.char
getDigitChar
(int digit) Gets the character that represents the specified digit.static DateTimeFormatSymbols
Gets theDateFormatSymbols
instance for the default locale.static DateTimeFormatSymbols
getInstance
(Locale locale) Gets theDateFormatSymbols
instance for the specified locale.Gets the locale to use for printing and parsing text.char
Gets the character that represents the negative sign.char
Gets the character that represents the positive sign.char
Gets the character that represents zero.
-
Field Details
-
locale
The locale for printing and parsing text. -
zeroChar
private final char zeroCharThe zero character.- See Also:
-
positiveSignChar
private final char positiveSignCharThe positive sign character.- See Also:
-
negativeSignChar
private final char negativeSignCharThe negative sign character.- See Also:
-
decimalPointChar
private final char decimalPointCharThe decimal point character.- See Also:
-
-
Constructor Details
-
DateTimeFormatSymbols
Constructor.- Parameters:
locale
- the locale, not null
-
DateTimeFormatSymbols
Constructor.- Parameters:
locale
- the locale, not nulloldSymbols
- the old symbols, not null
-
-
Method Details
-
getAvailableLocales
Returns an array of all locales for which thegetInstance
methods of this class can return localized instances. The returned array represents the union of locales supported by the Java runtime and by installedDateTimeFormatSymbolsProvider
implementations. It must contain at least aLocale
instance equal toLocale.US
.- Returns:
- an array of locales for which localized
DateTimeFormatSymbols
instances are available
-
getInstance
Gets theDateFormatSymbols
instance for the default locale. This method provides access toDateFormatSymbols
instances for locales supported by the Java runtime itself as well as for those supported by installedDateFormatSymbolsProvider
implementations.- Returns:
- a
DateTimeFormatSymbols
instance.
-
getInstance
Gets theDateFormatSymbols
instance for the specified locale. This method provides access toDateFormatSymbols
instances for locales supported by the Java runtime itself as well as for those supported by installedDateFormatSymbolsProvider
implementations.- Parameters:
locale
- the given locale, not null- Returns:
- a
DateTimeFormatSymbols
instance - Throws:
NullPointerException
- iflocale
is null
-
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
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
-