public final class DecimalStyle extends Object
Localized decimal style used in date and time formatting.
A significant part of dealing with dates and times is the localization. This class acts as a central point for accessing the information.
public static final DecimalStyle STANDARD
The standard set of non-localized decimal style symbols.
This uses standard ASCII characters for zero, positive, negative and a dot for the decimal point.
public static Set<Locale> getAvailableLocales()
Lists all the locales that are supported.
The locale 'en_US' will always be present.
public static DecimalStyle ofDefaultLocale()
Obtains the DecimalStyle for the default FORMAT
locale.
This method provides access to locale sensitive decimal style symbols.
This is equivalent to calling of(Locale.getDefault(Locale.Category.FORMAT))
.
Locale.Category.FORMAT
public static DecimalStyle of(Locale locale)
Obtains the DecimalStyle for the specified locale.
This method provides access to locale sensitive decimal style symbols.
locale
- the locale, not nullpublic 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.
public DecimalStyle withZeroDigit(char zeroDigit)
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.
zeroDigit
- the character for zeropublic 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.
public DecimalStyle withPositiveSign(char positiveSign)
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.
positiveSign
- the character for the positive signpublic 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.
public DecimalStyle withNegativeSign(char negativeSign)
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.
negativeSign
- the character for the negative signpublic 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.
public DecimalStyle withDecimalSeparator(char decimalSeparator)
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.
decimalSeparator
- the character for the decimal pointpublic boolean equals(Object obj)
Checks if this DecimalStyle is equal to another DecimalStyle.
equals
in class Object
obj
- the object to check, null returns falseObject.hashCode()
, HashMap
public int hashCode()
A hash code for this DecimalStyle.
hashCode
in class Object
Object.equals(java.lang.Object)
, System.identityHashCode(java.lang.Object)
public String toString()
Returns a string describing this DecimalStyle.
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.