Class DecimalStyle
A significant part of dealing with dates and times is the localization. This class acts as a central point for accessing the information.
Specification for implementors
This class is immutable and thread-safe.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if these symbols equal another set of symbols.Lists all the locales that are supported.char
Gets the character that represents the decimal point.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.int
hashCode()
A hash code for these symbols.static DecimalStyle
Obtains symbols for the specified locale.static DecimalStyle
Obtains symbols for the default locale.toString()
Returns a string describing these symbols.withDecimalSeparator(char decimalSeparator)
Returns a copy of the info with a new character that represents the decimal point.withNegativeSign(char negativeSign)
Returns a copy of the info with a new character that represents the negative sign.withPositiveSign(char positiveSign)
Returns a copy of the info with a new character that represents the positive sign.withZeroDigit(char zeroDigit)
Returns a copy of the info with a new character that represents zero.
-
Field Details
-
STANDARD
The standard set of non-localized symbols.This uses standard ASCII characters for zero, positive, negative and a dot for the decimal point.
-
-
Method Details
-
getAvailableLocales
Lists all the locales that are supported.The locale 'en_US' will always be present.
- Returns:
- an array of locales for which localization is supported
-
ofDefaultLocale
Obtains symbols for the default locale.This method provides access to locale sensitive symbols.
- Returns:
- the info, not null
-
of
Obtains symbols for the specified locale.This method provides access to locale sensitive symbols.
- Parameters:
locale
- the locale, not null- Returns:
- the info, not null
-
getZeroDigit
public char getZeroDigit()Gets the character that represents zero.The character used to represent digits may vary by culture. This method specifies the zero character to use, which implies the characters for one to nine.
- Returns:
- the character for zero
-
withZeroDigit
Returns a copy of the info with a new character that represents zero.The character used to represent digits may vary by culture. This method specifies the zero character to use, which implies the characters for one to nine.
- Parameters:
zeroDigit
- the character for zero- Returns:
- a copy with a new character that represents zero, not null
-
getPositiveSign
public char getPositiveSign()Gets the character that represents the positive sign.The character used to represent a positive number may vary by culture. This method specifies the character to use.
- Returns:
- the character for the positive sign
-
withPositiveSign
Returns a copy of the info with a new character that represents the positive sign.The character used to represent a positive number may vary by culture. This method specifies the character to use.
- Parameters:
positiveSign
- the character for the positive sign- Returns:
- a copy with a new character that represents the positive sign, not null
-
getNegativeSign
public char getNegativeSign()Gets the character that represents the negative sign.The character used to represent a negative number may vary by culture. This method specifies the character to use.
- Returns:
- the character for the negative sign
-
withNegativeSign
Returns a copy of the info with a new character that represents the negative sign.The character used to represent a negative number may vary by culture. This method specifies the character to use.
- Parameters:
negativeSign
- the character for the negative sign- Returns:
- a copy with a new character that represents the negative sign, not null
-
getDecimalSeparator
public char getDecimalSeparator()Gets the character that represents the decimal point.The character used to represent a decimal point may vary by culture. This method specifies the character to use.
- Returns:
- the character for the decimal point
-
withDecimalSeparator
Returns a copy of the info with a new character that represents the decimal point.The character used to represent a decimal point may vary by culture. This method specifies the character to use.
- Parameters:
decimalSeparator
- the character for the decimal point- Returns:
- a copy with a new character that represents the decimal point, not null
-
equals
Checks if these symbols equal another set of symbols. -
hashCode
public int hashCode()A hash code for these symbols. -
toString
Returns a string describing these symbols.
-