DecimalStyle (Java Platform SE 8 ) (original) (raw)
- java.time.format.DecimalStyle
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.
Implementation Requirements:
This class is immutable and thread-safe.
Since:
1.8
Field Summary
Fields
Modifier and Type Field Description static DecimalStyle STANDARD The standard set of non-localized decimal style symbols. Method Summary
All Methods Static Methods Instance Methods Concrete Methods
Modifier and Type Method Description boolean equals(Object obj) Checks if this DecimalStyle is equal to another DecimalStyle. static Set<Locale> 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(Locale locale) Obtains the DecimalStyle for the specified locale. static DecimalStyle ofDefaultLocale() Obtains the DecimalStyle for the defaultFORMAT locale. String toString() Returns a string describing this DecimalStyle. DecimalStyle withDecimalSeparator(char decimalSeparator) Returns a copy of the info with a new character that represents the decimal point. DecimalStyle withNegativeSign(char negativeSign) Returns a copy of the info with a new character that represents the negative sign. DecimalStyle withPositiveSign(char positiveSign) Returns a copy of the info with a new character that represents the positive sign. DecimalStyle withZeroDigit(char zeroDigit) Returns a copy of the info with a new character that represents zero. * ### Methods inherited from class java.lang.[Object](../../../java/lang/Object.html "class in java.lang") `[clone](../../../java/lang/Object.html#clone--), [finalize](../../../java/lang/Object.html#finalize--), [getClass](../../../java/lang/Object.html#getClass--), [notify](../../../java/lang/Object.html#notify--), [notifyAll](../../../java/lang/Object.html#notifyAll--), [wait](../../../java/lang/Object.html#wait--), [wait](../../../java/lang/Object.html#wait-long-), [wait](../../../java/lang/Object.html#wait-long-int-)`
Field Detail
* #### STANDARD public static final [DecimalStyle](../../../java/time/format/DecimalStyle.html "class in java.time.format") 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.
Method Detail
* #### getAvailableLocales public static [Set](../../../java/util/Set.html "interface in java.util")<[Locale](../../../java/util/Locale.html "class in java.util")> getAvailableLocales() Lists all the locales that are supported. The locale 'en\_US' will always be present. Returns: a Set of Locales for which localization is supported * #### ofDefaultLocale public static [DecimalStyle](../../../java/time/format/DecimalStyle.html "class in java.time.format") ofDefaultLocale() Returns: the decimal style, not null See Also: [Locale.Category.FORMAT](../../../java/util/Locale.Category.html#FORMAT) * #### of public static [DecimalStyle](../../../java/time/format/DecimalStyle.html "class in java.time.format") of([Locale](../../../java/util/Locale.html "class in java.util") locale) Obtains the DecimalStyle for the specified locale. This method provides access to locale sensitive decimal style symbols. Parameters: `locale` \- the locale, not null Returns: the decimal style, 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 public [DecimalStyle](../../../java/time/format/DecimalStyle.html "class in java.time.format") 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. 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 public [DecimalStyle](../../../java/time/format/DecimalStyle.html "class in java.time.format") 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. 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 public [DecimalStyle](../../../java/time/format/DecimalStyle.html "class in java.time.format") 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. 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 public [DecimalStyle](../../../java/time/format/DecimalStyle.html "class in java.time.format") 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. Parameters: `decimalSeparator` \- the character for the decimal point Returns: a copy with a new character that represents the decimal point, not null * #### equals public boolean equals([Object](../../../java/lang/Object.html "class in java.lang") obj) Checks if this DecimalStyle is equal to another DecimalStyle. Overrides: `[equals](../../../java/lang/Object.html#equals-java.lang.Object-)` in class `[Object](../../../java/lang/Object.html "class in java.lang")` Parameters: `obj` \- the object to check, null returns false Returns: true if this is equal to the other date See Also: [Object.hashCode()](../../../java/lang/Object.html#hashCode--), [HashMap](../../../java/util/HashMap.html "class in java.util") * #### hashCode public int hashCode() A hash code for this DecimalStyle. Overrides: `[hashCode](../../../java/lang/Object.html#hashCode--)` in class `[Object](../../../java/lang/Object.html "class in java.lang")` Returns: a suitable hash code See Also: [Object.equals(java.lang.Object)](../../../java/lang/Object.html#equals-java.lang.Object-), [System.identityHashCode(java.lang.Object)](../../../java/lang/System.html#identityHashCode-java.lang.Object-) * #### toString public [String](../../../java/lang/String.html "class in java.lang") toString() Returns a string describing this DecimalStyle. Overrides: `[toString](../../../java/lang/Object.html#toString--)` in class `[Object](../../../java/lang/Object.html "class in java.lang")` Returns: a string description, not null
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.