Class NumberFormatter

    • Field Detail

      • numDecimals

        private int numDecimals
      • doubleValues

        private boolean doubleValues
    • Constructor Detail

      • NumberFormatter

        public NumberFormatter​(int numDecimals,
                               boolean doubleValues)
        Create a new number formatter.
        Parameters:
        numDecimals - The number of decimals to display, or a negative value to display all decimals
        doubleValues - If the parseString(String) should return double or float values
        See Also:
        Values.formatNumber(Float, int)
    • Method Detail

      • format

        public String format​(Number value)
        Description copied from interface: Formatter
        Format a value by converting it to a string.
        Specified by:
        format in interface Formatter<Number>
        Parameters:
        value - The value to format
        Returns:
        A formatted string
      • parseString

        public Number parseString​(String value)
        Description copied from interface: Formatter
        Parse a string and return a value of the correct type. A null input string should (unless otherwise documented by a specific formatter implementation) be allowed and may return null or any other "default" value.
        Specified by:
        parseString in interface Formatter<Number>
        Parameters:
        value - The string to parse
        Returns:
        An object
      • toExcelValue

        public ExcelValue<Number> toExcelValue​(Number value)
        Description copied from interface: ExcelFormatter
        Convert and format the given value to an Excel value. If the value is null the implementation may return null to create an empty cell or it may return another non-null value.
        Specified by:
        toExcelValue in interface ExcelFormatter<Number,​Number>
        Since:
        3.15