Class DecimalFormatProperties

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class DecimalFormatProperties
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Auto-generated.
        See Also:
        Constant Field Values
      • compactCustomData

        private transient java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.String>> compactCustomData
      • currency

        private transient Currency currency
      • decimalPatternMatchRequired

        private transient boolean decimalPatternMatchRequired
      • decimalSeparatorAlwaysShown

        private transient boolean decimalSeparatorAlwaysShown
      • exponentSignAlwaysShown

        private transient boolean exponentSignAlwaysShown
      • currencyAsDecimal

        private transient boolean currencyAsDecimal
      • formatWidth

        private transient int formatWidth
      • groupingSize

        private transient int groupingSize
      • groupingUsed

        private transient boolean groupingUsed
      • magnitudeMultiplier

        private transient int magnitudeMultiplier
      • mathContext

        private transient java.math.MathContext mathContext
      • maximumFractionDigits

        private transient int maximumFractionDigits
      • maximumIntegerDigits

        private transient int maximumIntegerDigits
      • maximumSignificantDigits

        private transient int maximumSignificantDigits
      • minimumExponentDigits

        private transient int minimumExponentDigits
      • minimumFractionDigits

        private transient int minimumFractionDigits
      • minimumGroupingDigits

        private transient int minimumGroupingDigits
      • minimumIntegerDigits

        private transient int minimumIntegerDigits
      • minimumSignificantDigits

        private transient int minimumSignificantDigits
      • multiplier

        private transient java.math.BigDecimal multiplier
      • negativePrefix

        private transient java.lang.String negativePrefix
      • negativePrefixPattern

        private transient java.lang.String negativePrefixPattern
      • negativeSuffix

        private transient java.lang.String negativeSuffix
      • negativeSuffixPattern

        private transient java.lang.String negativeSuffixPattern
      • padString

        private transient java.lang.String padString
      • parseCaseSensitive

        private transient boolean parseCaseSensitive
      • parseIntegerOnly

        private transient boolean parseIntegerOnly
      • parseNoExponent

        private transient boolean parseNoExponent
      • parseToBigDecimal

        private transient boolean parseToBigDecimal
      • pluralRules

        private transient PluralRules pluralRules
      • positivePrefix

        private transient java.lang.String positivePrefix
      • positivePrefixPattern

        private transient java.lang.String positivePrefixPattern
      • positiveSuffix

        private transient java.lang.String positiveSuffix
      • positiveSuffixPattern

        private transient java.lang.String positiveSuffixPattern
      • roundingIncrement

        private transient java.math.BigDecimal roundingIncrement
      • roundingMode

        private transient java.math.RoundingMode roundingMode
      • secondaryGroupingSize

        private transient int secondaryGroupingSize
      • signAlwaysShown

        private transient boolean signAlwaysShown
    • Constructor Detail

      • DecimalFormatProperties

        public DecimalFormatProperties()
    • Method Detail

      • _clear

        private DecimalFormatProperties _clear()
        Sets all properties to their defaults (unset).

        All integers default to -1 EXCEPT FOR MAGNITUDE MULTIPLIER which has a default of 0 (since negative numbers are important).

        All booleans default to false.

        All non-primitive types default to null.

        Returns:
        The property bag, for chaining.
      • _equalsHelper

        private boolean _equalsHelper​(boolean mine,
                                      boolean theirs)
      • _equalsHelper

        private boolean _equalsHelper​(int mine,
                                      int theirs)
      • _equalsHelper

        private boolean _equalsHelper​(java.lang.Object mine,
                                      java.lang.Object theirs)
      • _hashCode

        private int _hashCode()
      • _hashCodeHelper

        private int _hashCodeHelper​(boolean value)
      • _hashCodeHelper

        private int _hashCodeHelper​(int value)
      • _hashCodeHelper

        private int _hashCodeHelper​(java.lang.Object value)
      • clone

        public DecimalFormatProperties clone()
        Creates and returns a shallow copy of the property bag.
        Overrides:
        clone in class java.lang.Object
      • copyFrom

        public DecimalFormatProperties copyFrom​(DecimalFormatProperties other)
        Shallow-copies the properties from the given property bag into this property bag.
        Parameters:
        other - The property bag from which to copy and which will not be modified.
        Returns:
        The current property bag (the one modified by this operation), for chaining.
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • getCompactCustomData

        public java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.String>> getCompactCustomData()
      • getCurrency

        public Currency getCurrency()
      • getDecimalPatternMatchRequired

        public boolean getDecimalPatternMatchRequired()
      • getDecimalSeparatorAlwaysShown

        public boolean getDecimalSeparatorAlwaysShown()
      • getExponentSignAlwaysShown

        public boolean getExponentSignAlwaysShown()
      • getCurrencyAsDecimal

        public boolean getCurrencyAsDecimal()
      • getFormatWidth

        public int getFormatWidth()
      • getGroupingSize

        public int getGroupingSize()
      • getGroupingUsed

        public boolean getGroupingUsed()
      • getMagnitudeMultiplier

        public int getMagnitudeMultiplier()
      • getMathContext

        public java.math.MathContext getMathContext()
      • getMaximumFractionDigits

        public int getMaximumFractionDigits()
      • getMaximumIntegerDigits

        public int getMaximumIntegerDigits()
      • getMaximumSignificantDigits

        public int getMaximumSignificantDigits()
      • getMinimumExponentDigits

        public int getMinimumExponentDigits()
      • getMinimumFractionDigits

        public int getMinimumFractionDigits()
      • getMinimumGroupingDigits

        public int getMinimumGroupingDigits()
      • getMinimumIntegerDigits

        public int getMinimumIntegerDigits()
      • getMinimumSignificantDigits

        public int getMinimumSignificantDigits()
      • getMultiplier

        public java.math.BigDecimal getMultiplier()
      • getNegativePrefix

        public java.lang.String getNegativePrefix()
      • getNegativePrefixPattern

        public java.lang.String getNegativePrefixPattern()
      • getNegativeSuffix

        public java.lang.String getNegativeSuffix()
      • getNegativeSuffixPattern

        public java.lang.String getNegativeSuffixPattern()
      • getPadString

        public java.lang.String getPadString()
      • getParseCaseSensitive

        public boolean getParseCaseSensitive()
      • getParseIntegerOnly

        public boolean getParseIntegerOnly()
      • getParseNoExponent

        public boolean getParseNoExponent()
      • getParseToBigDecimal

        public boolean getParseToBigDecimal()
      • getPositivePrefix

        public java.lang.String getPositivePrefix()
      • getPositivePrefixPattern

        public java.lang.String getPositivePrefixPattern()
      • getPositiveSuffix

        public java.lang.String getPositiveSuffix()
      • getPositiveSuffixPattern

        public java.lang.String getPositiveSuffixPattern()
      • getRoundingIncrement

        public java.math.BigDecimal getRoundingIncrement()
      • getRoundingMode

        public java.math.RoundingMode getRoundingMode()
      • getSecondaryGroupingSize

        public int getSecondaryGroupingSize()
      • getSignAlwaysShown

        public boolean getSignAlwaysShown()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • readObject

        private void readObject​(java.io.ObjectInputStream ois)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Custom serialization: re-create object from serialized properties.
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • readObjectImpl

        void readObjectImpl​(java.io.ObjectInputStream ois)
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • setCompactCustomData

        public DecimalFormatProperties setCompactCustomData​(java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​java.lang.String>> compactCustomData)
        Specifies custom data to be used instead of CLDR data when constructing a CompactDecimalFormat. The argument should be a map with the following structure:
         {
           "1000": {
             "one": "0 thousand",
             "other": "0 thousand"
           },
           "10000": {
             "one": "00 thousand",
             "other": "00 thousand"
           },
           // ...
         }
         
        This API endpoint is used by the CLDR Survey Tool.
        Parameters:
        compactCustomData - A map with the above structure.
        Returns:
        The property bag, for chaining.
      • setCompactStyle

        public DecimalFormatProperties setCompactStyle​(CompactDecimalFormat.CompactStyle compactStyle)
        Use compact decimal formatting with the specified CompactDecimalFormat.CompactStyle. CompactStyle.SHORT produces output like "10K" in locale en-US, whereas CompactStyle.LONG produces output like "10 thousand" in that locale.
        Parameters:
        compactStyle - The style of prefixes/suffixes to append.
        Returns:
        The property bag, for chaining.
      • setCurrency

        public DecimalFormatProperties setCurrency​(Currency currency)
        Use the specified currency to substitute currency placeholders ('¤') in the pattern string.
        Parameters:
        currency - The currency.
        Returns:
        The property bag, for chaining.
      • setCurrencyPluralInfo

        public DecimalFormatProperties setCurrencyPluralInfo​(CurrencyPluralInfo currencyPluralInfo)
        Use the specified CurrencyPluralInfo instance when formatting currency long names.
        Parameters:
        currencyPluralInfo - The currency plural info object.
        Returns:
        The property bag, for chaining.
      • setCurrencyUsage

        public DecimalFormatProperties setCurrencyUsage​(Currency.CurrencyUsage currencyUsage)
        Use the specified Currency.CurrencyUsage instance, which provides default rounding rules for the currency in two styles, CurrencyUsage.CASH and CurrencyUsage.STANDARD.

        The CurrencyUsage specified here will not be used unless there is a currency placeholder in the pattern.

        Parameters:
        currencyUsage - The currency usage. Defaults to CurrencyUsage.STANDARD.
        Returns:
        The property bag, for chaining.
      • setDecimalPatternMatchRequired

        public DecimalFormatProperties setDecimalPatternMatchRequired​(boolean decimalPatternMatchRequired)
        PARSING: Whether to require that the presence of decimal point matches the pattern. If a decimal point is not present, but the pattern contained a decimal point, parse will not succeed: null will be returned from parse(), and an error index will be set in the ParsePosition.
        Parameters:
        decimalPatternMatchRequired - true to set an error if decimal is not present
        Returns:
        The property bag, for chaining.
      • setDecimalSeparatorAlwaysShown

        public DecimalFormatProperties setDecimalSeparatorAlwaysShown​(boolean alwaysShowDecimal)
        Sets whether to always show the decimal point, even if the number doesn't require one. For example, if always show decimal is true, the number 123 would be formatted as "123." in locale en-US.
        Parameters:
        alwaysShowDecimal - Whether to show the decimal point when it is optional.
        Returns:
        The property bag, for chaining.
      • setExponentSignAlwaysShown

        public DecimalFormatProperties setExponentSignAlwaysShown​(boolean exponentSignAlwaysShown)
        Sets whether to show the plus sign in the exponent part of numbers with a zero or positive exponent. For example, the number "1200" with the pattern "0.0E0" would be formatted as "1.2E+3" instead of "1.2E3" in en-US.
        Parameters:
        exponentSignAlwaysShown - Whether to show the plus sign in positive exponents.
        Returns:
        The property bag, for chaining.
      • setCurrencyAsDecimal

        public DecimalFormatProperties setCurrencyAsDecimal​(boolean currencyAsDecimal)
        Sets whether the currency symbol should replace the decimal separator.
        Parameters:
        currencyAsDecimal - Whether the currency symbol should replace the decimal separator.
        Returns:
        The property bag, for chaining.
      • setFormatWidth

        public DecimalFormatProperties setFormatWidth​(int paddingWidth)
        Sets the minimum width of the string output by the formatting pipeline. For example, if padding is enabled and paddingWidth is set to 6, formatting the number "3.14159" with the pattern "0.00" will result in "··3.14" if '·' is your padding string.

        If the number is longer than your padding width, the number will display as if no padding width had been specified, which may result in strings longer than the padding width.

        Width is counted in UTF-16 code units.

        Parameters:
        paddingWidth - The output width.
        Returns:
        The property bag, for chaining.
        See Also:
        setPadPosition(com.ibm.icu.impl.number.Padder.PadPosition), setPadString(java.lang.String)
      • setGroupingSize

        public DecimalFormatProperties setGroupingSize​(int groupingSize)
        Sets the number of digits between grouping separators. For example, the en-US locale uses a grouping size of 3, so the number 1234567 would be formatted as "1,234,567". For locales whose grouping sizes vary with magnitude, see setSecondaryGroupingSize(int).
        Parameters:
        groupingSize - The primary grouping size.
        Returns:
        The property bag, for chaining.
      • setGroupingUsed

        public DecimalFormatProperties setGroupingUsed​(boolean groupingUsed)
        Sets whether to enable grouping when formatting.
        Parameters:
        groupingUsed - true to enable the display of grouping separators; false to disable.
        Returns:
        The property bag, for chaining.
      • setMagnitudeMultiplier

        public DecimalFormatProperties setMagnitudeMultiplier​(int magnitudeMultiplier)
        Multiply all numbers by this power of ten before formatting. Negative multipliers reduce the magnitude and make numbers smaller (closer to zero).
        Parameters:
        magnitudeMultiplier - The number of powers of ten to scale.
        Returns:
        The property bag, for chaining.
        See Also:
        setMultiplier(java.math.BigDecimal)
      • setMathContext

        public DecimalFormatProperties setMathContext​(java.math.MathContext mathContext)
        Sets the MathContext to be used during math and rounding operations. A MathContext encapsulates a RoundingMode and the number of significant digits in the output.
        Parameters:
        mathContext - The math context to use when rounding is required.
        Returns:
        The property bag, for chaining.
        See Also:
        MathContext, setRoundingMode(java.math.RoundingMode)
      • setMaximumFractionDigits

        public DecimalFormatProperties setMaximumFractionDigits​(int maximumFractionDigits)
        Sets the maximum number of digits to display after the decimal point. If the number has fewer than this number of digits, the number will be rounded off using the rounding mode specified by setRoundingMode(RoundingMode). The pattern "#00.0#", for example, corresponds to 2 maximum fraction digits, and the number 456.789 would be formatted as "456.79" in locale en-US with the default rounding mode. Note that the number 456.999 would be formatted as "457.0" given the same configurations.
        Parameters:
        maximumFractionDigits - The maximum number of fraction digits to output.
        Returns:
        The property bag, for chaining.
      • setMaximumIntegerDigits

        public DecimalFormatProperties setMaximumIntegerDigits​(int maximumIntegerDigits)
        Sets the maximum number of digits to display before the decimal point. If the number has more than this number of digits, the extra digits will be truncated. For example, if maximum integer digits is 2, and you attempt to format the number 1970, you will get "70" in locale en-US. It is not possible to specify the maximum integer digits using a pattern string, except in the special case of a scientific format pattern.
        Parameters:
        maximumIntegerDigits - The maximum number of integer digits to output.
        Returns:
        The property bag, for chaining.
      • setMaximumSignificantDigits

        public DecimalFormatProperties setMaximumSignificantDigits​(int maximumSignificantDigits)
        Sets the maximum number of significant digits to display. The number of significant digits is equal to the number of digits counted from the leftmost nonzero digit through the rightmost nonzero digit; for example, the number "2010" has 3 significant digits. If the number has more significant digits than specified here, the extra significant digits will be rounded off using the rounding mode specified by setRoundingMode(RoundingMode). For example, if maximum significant digits is 3, the number 1234.56 will be formatted as "1230" in locale en-US with the default rounding mode.

        If both maximum significant digits and maximum integer/fraction digits are set at the same time, the behavior is undefined.

        The number of significant digits can be specified in a pattern string using the '@' character. For example, the pattern "@@#" corresponds to a minimum of 2 and a maximum of 3 significant digits.

        Parameters:
        maximumSignificantDigits - The maximum number of significant digits to display.
        Returns:
        The property bag, for chaining.
      • setMinimumExponentDigits

        public DecimalFormatProperties setMinimumExponentDigits​(int minimumExponentDigits)
        Sets the minimum number of digits to display in the exponent. For example, the number "1200" with the pattern "0.0E00", which has 2 exponent digits, would be formatted as "1.2E03" in en-US.
        Parameters:
        minimumExponentDigits - The minimum number of digits to display in the exponent field.
        Returns:
        The property bag, for chaining.
      • setMinimumFractionDigits

        public DecimalFormatProperties setMinimumFractionDigits​(int minimumFractionDigits)
        Sets the minimum number of digits to display after the decimal point. If the number has fewer than this number of digits, the number will be padded with zeros. The pattern "#00.0#", for example, corresponds to 1 minimum fraction digit, and the number 456 would be formatted as "456.0" in locale en-US.
        Parameters:
        minimumFractionDigits - The minimum number of fraction digits to output.
        Returns:
        The property bag, for chaining.
      • setMinimumGroupingDigits

        public DecimalFormatProperties setMinimumGroupingDigits​(int minimumGroupingDigits)
        Sets the minimum number of digits required to be beyond the first grouping separator in order to enable grouping. For example, if the minimum grouping digits is 2, then 1234 would be formatted as "1234" but 12345 would be formatted as "12,345" in en-US. Note that 1234567 would still be formatted as "1,234,567", not "1234,567".
        Parameters:
        minimumGroupingDigits - How many digits must appear before a grouping separator before enabling grouping.
        Returns:
        The property bag, for chaining.
      • setMinimumIntegerDigits

        public DecimalFormatProperties setMinimumIntegerDigits​(int minimumIntegerDigits)
        Sets the minimum number of digits to display before the decimal point. If the number has fewer than this number of digits, the number will be padded with zeros. The pattern "#00.0#", for example, corresponds to 2 minimum integer digits, and the number 5.3 would be formatted as "05.3" in locale en-US.
        Parameters:
        minimumIntegerDigits - The minimum number of integer digits to output.
        Returns:
        The property bag, for chaining.
      • setMinimumSignificantDigits

        public DecimalFormatProperties setMinimumSignificantDigits​(int minimumSignificantDigits)
        Sets the minimum number of significant digits to display. If, after rounding to the number of significant digits specified by setMaximumSignificantDigits(int), the number of remaining significant digits is less than the minimum, the number will be padded with zeros. For example, if minimum significant digits is 3, the number 5.8 will be formatted as "5.80" in locale en-US. Note that minimum significant digits is relevant only when numbers have digits after the decimal point.

        If both minimum significant digits and minimum integer/fraction digits are set at the same time, both values will be respected, and the one that results in the greater number of padding zeros will be used. For example, formatting the number 73 with 3 minimum significant digits and 2 minimum fraction digits will produce "73.00".

        The number of significant digits can be specified in a pattern string using the '@' character. For example, the pattern "@@#" corresponds to a minimum of 2 and a maximum of 3 significant digits.

        Parameters:
        minimumSignificantDigits - The minimum number of significant digits to display.
        Returns:
        The property bag, for chaining.
      • setMultiplier

        public DecimalFormatProperties setMultiplier​(java.math.BigDecimal multiplier)
        Multiply all numbers by this amount before formatting.
        Parameters:
        multiplier - The amount to multiply by.
        Returns:
        The property bag, for chaining.
        See Also:
        setMagnitudeMultiplier(int)
      • setNegativePrefix

        public DecimalFormatProperties setNegativePrefix​(java.lang.String negativePrefix)
        Sets the prefix to prepend to negative numbers. The prefix will be interpreted literally. For example, if you set a negative prefix of n, then the number -123 will be formatted as "n123" in the locale en-US. Note that if the negative prefix is left unset, the locale's minus sign is used.

        For more information on prefixes and suffixes, see MutablePatternModifier.

        Parameters:
        negativePrefix - The CharSequence to prepend to negative numbers.
        Returns:
        The property bag, for chaining.
        See Also:
        setNegativePrefixPattern(java.lang.String)
      • setNegativePrefixPattern

        public DecimalFormatProperties setNegativePrefixPattern​(java.lang.String negativePrefixPattern)
        Sets the prefix to prepend to negative numbers. Locale-specific symbols will be substituted into the string according to Unicode Technical Standard #35 (LDML).

        For more information on prefixes and suffixes, see MutablePatternModifier.

        Parameters:
        negativePrefixPattern - The CharSequence to prepend to negative numbers after locale symbol substitutions take place.
        Returns:
        The property bag, for chaining.
        See Also:
        setNegativePrefix(java.lang.String)
      • setNegativeSuffix

        public DecimalFormatProperties setNegativeSuffix​(java.lang.String negativeSuffix)
        Sets the suffix to append to negative numbers. The suffix will be interpreted literally. For example, if you set a suffix prefix of n, then the number -123 will be formatted as "-123n" in the locale en-US. Note that the minus sign is prepended by default unless otherwise specified in either the pattern string or in one of the setNegativePrefix(java.lang.String) methods.

        For more information on prefixes and suffixes, see MutablePatternModifier.

        Parameters:
        negativeSuffix - The CharSequence to append to negative numbers.
        Returns:
        The property bag, for chaining.
        See Also:
        setNegativeSuffixPattern(java.lang.String)
      • setNegativeSuffixPattern

        public DecimalFormatProperties setNegativeSuffixPattern​(java.lang.String negativeSuffixPattern)
        Sets the suffix to append to negative numbers. Locale-specific symbols will be substituted into the string according to Unicode Technical Standard #35 (LDML).

        For more information on prefixes and suffixes, see MutablePatternModifier.

        Parameters:
        negativeSuffixPattern - The CharSequence to append to negative numbers after locale symbol substitutions take place.
        Returns:
        The property bag, for chaining.
        See Also:
        setNegativeSuffix(java.lang.String)
      • setPadPosition

        public DecimalFormatProperties setPadPosition​(Padder.PadPosition paddingLocation)
        Sets the location where the padding string is to be inserted to maintain the padding width: one of BEFORE_PREFIX, AFTER_PREFIX, BEFORE_SUFFIX, or AFTER_SUFFIX.

        Must be used in conjunction with setFormatWidth(int).

        Parameters:
        paddingLocation - The output width.
        Returns:
        The property bag, for chaining.
        See Also:
        setFormatWidth(int)
      • setPadString

        public DecimalFormatProperties setPadString​(java.lang.String paddingString)
        Sets the string used for padding. The string should contain a single character or grapheme cluster.

        Must be used in conjunction with setFormatWidth(int).

        Parameters:
        paddingString - The padding string. Defaults to an ASCII space (U+0020).
        Returns:
        The property bag, for chaining.
        See Also:
        setFormatWidth(int)
      • setParseCaseSensitive

        public DecimalFormatProperties setParseCaseSensitive​(boolean parseCaseSensitive)
        Whether to require cases to match when parsing strings; default is true. Case sensitivity applies to prefixes, suffixes, the exponent separator, the symbol "NaN", and the infinity symbol. Grouping separators, decimal separators, and padding are always case-sensitive. Currencies are always case-insensitive.

        This setting is ignored in fast mode. In fast mode, strings are always compared in a case-sensitive way.

        Parameters:
        parseCaseSensitive - true to be case-sensitive when parsing; false to allow any case.
        Returns:
        The property bag, for chaining.
      • setParseIntegerOnly

        public DecimalFormatProperties setParseIntegerOnly​(boolean parseIntegerOnly)
        Whether to ignore the fractional part of numbers. For example, parses "123.4" to "123" instead of "123.4".
        Parameters:
        parseIntegerOnly - true to parse integers only; false to parse integers with their fraction parts
        Returns:
        The property bag, for chaining.
      • setParseNoExponent

        public DecimalFormatProperties setParseNoExponent​(boolean parseNoExponent)
        Whether to ignore the exponential part of numbers. For example, parses "123E4" to "123" instead of "1230000".
        Parameters:
        parseNoExponent - true to ignore exponents; false to parse them.
        Returns:
        The property bag, for chaining.
      • setParseToBigDecimal

        public DecimalFormatProperties setParseToBigDecimal​(boolean parseToBigDecimal)
        Whether to always return a BigDecimal from parse methods. By default, a Long or a BigInteger are returned when possible.
        Parameters:
        parseToBigDecimal - true to always return a BigDecimal; false to return a Long or a BigInteger when possible.
        Returns:
        The property bag, for chaining.
      • setPluralRules

        public DecimalFormatProperties setPluralRules​(PluralRules pluralRules)
        Sets the PluralRules object to use instead of the default for the locale.
        Parameters:
        pluralRules - The object to reference.
        Returns:
        The property bag, for chaining.
      • setPositivePrefix

        public DecimalFormatProperties setPositivePrefix​(java.lang.String positivePrefix)
        Sets the prefix to prepend to positive numbers. The prefix will be interpreted literally. For example, if you set a positive prefix of p, then the number 123 will be formatted as "p123" in the locale en-US.

        For more information on prefixes and suffixes, see MutablePatternModifier.

        Parameters:
        positivePrefix - The CharSequence to prepend to positive numbers.
        Returns:
        The property bag, for chaining.
        See Also:
        setPositivePrefixPattern(java.lang.String)
      • setPositivePrefixPattern

        public DecimalFormatProperties setPositivePrefixPattern​(java.lang.String positivePrefixPattern)
        Sets the prefix to prepend to positive numbers. Locale-specific symbols will be substituted into the string according to Unicode Technical Standard #35 (LDML).

        For more information on prefixes and suffixes, see MutablePatternModifier.

        Parameters:
        positivePrefixPattern - The CharSequence to prepend to positive numbers after locale symbol substitutions take place.
        Returns:
        The property bag, for chaining.
        See Also:
        setPositivePrefix(java.lang.String)
      • setPositiveSuffix

        public DecimalFormatProperties setPositiveSuffix​(java.lang.String positiveSuffix)
        Sets the suffix to append to positive numbers. The suffix will be interpreted literally. For example, if you set a positive suffix of p, then the number 123 will be formatted as "123p" in the locale en-US.

        For more information on prefixes and suffixes, see MutablePatternModifier.

        Parameters:
        positiveSuffix - The CharSequence to append to positive numbers.
        Returns:
        The property bag, for chaining.
        See Also:
        setPositiveSuffixPattern(java.lang.String)
      • setPositiveSuffixPattern

        public DecimalFormatProperties setPositiveSuffixPattern​(java.lang.String positiveSuffixPattern)
        Sets the suffix to append to positive numbers. Locale-specific symbols will be substituted into the string according to Unicode Technical Standard #35 (LDML).

        For more information on prefixes and suffixes, see MutablePatternModifier.

        Parameters:
        positiveSuffixPattern - The CharSequence to append to positive numbers after locale symbol substitutions take place.
        Returns:
        The property bag, for chaining.
        See Also:
        setPositiveSuffix(java.lang.String)
      • setRoundingIncrement

        public DecimalFormatProperties setRoundingIncrement​(java.math.BigDecimal roundingIncrement)
        Sets the increment to which to round numbers. For example, with a rounding interval of 0.05, the number 11.17 would be formatted as "11.15" in locale en-US with the default rounding mode.

        You can use either a rounding increment or significant digits, but not both at the same time.

        The rounding increment can be specified in a pattern string. For example, the pattern "#,##0.05" corresponds to a rounding interval of 0.05 with 1 minimum integer digit and a grouping size of 3.

        Parameters:
        roundingIncrement - The interval to which to round.
        Returns:
        The property bag, for chaining.
      • setRoundingMode

        public DecimalFormatProperties setRoundingMode​(java.math.RoundingMode roundingMode)
        Sets the rounding mode, which determines under which conditions extra decimal places are rounded either up or down. See RoundingMode for details on the choices of rounding mode. The default if not set explicitly is RoundingMode.HALF_EVEN.

        This setting is ignored if setMathContext(java.math.MathContext) is used.

        Parameters:
        roundingMode - The rounding mode to use when rounding is required.
        Returns:
        The property bag, for chaining.
        See Also:
        RoundingMode, setMathContext(java.math.MathContext)
      • setSecondaryGroupingSize

        public DecimalFormatProperties setSecondaryGroupingSize​(int secondaryGroupingSize)
        Sets the number of digits between grouping separators higher than the least-significant grouping separator. For example, the locale hi uses a primary grouping size of 3 and a secondary grouping size of 2, so the number 1234567 would be formatted as "12,34,567".

        The two levels of grouping separators can be specified in the pattern string. For example, the hi locale's default decimal format pattern is "#,##,##0.###".

        Parameters:
        secondaryGroupingSize - The secondary grouping size.
        Returns:
        The property bag, for chaining.
      • setSignAlwaysShown

        public DecimalFormatProperties setSignAlwaysShown​(boolean signAlwaysShown)
        Sets whether to always display of a plus sign on positive numbers.

        If the location of the negative sign is specified by the decimal format pattern (or by the negative prefix/suffix pattern methods), a plus sign is substituted into that location, in accordance with Unicode Technical Standard #35 (LDML) section 3.2.1. Otherwise, the plus sign is prepended to the number. For example, if the decimal format pattern #;#- is used, then formatting 123 would result in "123+" in the locale en-US.

        This method should be used instead of setting the positive prefix/suffix. The behavior is undefined if alwaysShowPlusSign is set but the positive prefix/suffix already contains a plus sign.

        Parameters:
        signAlwaysShown - Whether positive numbers should display a plus sign.
        Returns:
        The property bag, for chaining.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toStringBare

        public void toStringBare​(java.lang.StringBuilder result)
        Appends a string containing properties that differ from the default, but without being surrounded by <Properties>.
      • writeObject

        private void writeObject​(java.io.ObjectOutputStream oos)
                          throws java.io.IOException
        Custom serialization: save fields along with their name, so that fields can be easily added in the future in any order. Only save fields that differ from their default value.
        Throws:
        java.io.IOException
      • writeObjectImpl

        void writeObjectImpl​(java.io.ObjectOutputStream oos)
                      throws java.io.IOException
        Throws:
        java.io.IOException