public final class DecimalStyle extends Object
A significant part of dealing with dates and times is the localization. This class acts as a central point for accessing the information.
Modifier and Type | Field | Description |
---|---|---|
static final DecimalStyle |
STANDARD |
The standard set of non-localized decimal style symbols. |
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals |
Checks if this DecimalStyle is equal to another DecimalStyle. |
static Set |
getAvailableLocales() |
Lists all the locales that are supported. |
char |
getDecimalSeparator() |
Gets the character that represents the decimal point. |
char |
getNegativeSign() |
Gets the character that represents the negative sign. |
char |
getPositiveSign() |
Gets the character that represents the positive sign. |
char |
getZeroDigit() |
Gets the character that represents zero. |
int |
hashCode() |
A hash code for this DecimalStyle. |
static DecimalStyle |
of |
Obtains the DecimalStyle for the specified locale. |
static DecimalStyle |
ofDefaultLocale() |
Obtains the DecimalStyle for the default FORMAT locale. |
String |
toString() |
Returns a string describing this DecimalStyle. |
DecimalStyle |
withDecimalSeparator |
Returns a copy of the info with a new character that represents the decimal point. |
DecimalStyle |
withNegativeSign |
Returns a copy of the info with a new character that represents the negative sign. |
DecimalStyle |
withPositiveSign |
Returns a copy of the info with a new character that represents the positive sign. |
DecimalStyle |
withZeroDigit |
Returns a copy of the info with a new character that represents zero. |
public static final DecimalStyle STANDARD
This uses standard ASCII characters for zero, positive, negative and a dot for the decimal point.
public static Set<Locale> getAvailableLocales()
At a minimum, the returned Set
must contain a Locale
instance equal to Locale.ROOT
and a Locale
instance equal to Locale.US
.
public static DecimalStyle ofDefaultLocale()
FORMAT
locale. This method provides access to locale sensitive decimal style symbols.
This is equivalent to calling of(Locale.getDefault(Locale.Category.FORMAT))
.
public static DecimalStyle of(Locale locale)
This method provides access to locale sensitive decimal style symbols. If the locale contains "nu" (Numbering System) and/or "rg" (Region Override) Unicode extensions, returned instance will reflect the values specified with those extensions. If both "nu" and "rg" are specified, the value from the "nu" extension supersedes the implicit one from the "rg" extension.
locale
- the locale, not nullpublic char getZeroDigit()
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)
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()
The character used to represent a positive number may vary by culture. This method specifies the character to use.
public DecimalStyle withPositiveSign(char positiveSign)
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()
The character used to represent a negative number may vary by culture. This method specifies the character to use.
public DecimalStyle withNegativeSign(char negativeSign)
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()
The character used to represent a decimal point may vary by culture. This method specifies the character to use.
public DecimalStyle withDecimalSeparator(char decimalSeparator)
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)
public int hashCode()
public String toString()
© 1993, 2023, 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.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/format/DecimalStyle.html