Class NumberFormatter

    • Field Detail

      • INTEGER

        public static final CellFormatter INTEGER
        An instance of this class that formats as integers (no decimal places). For example
             12345 formatted as "12,345"
         
      • TO_5DP

        public static final CellFormatter TO_5DP
        An instance of this class that formats to 5 decimal places. For example
             12.3 formatted as "12.30000"
             1234 formatted as "1,234.00000"
         
    • Constructor Detail

      • NumberFormatter

        public NumberFormatter()
        Creates a formatter using the default format (no decimal places). For example
             12345 formatted as "12,345"
         
      • NumberFormatter

        public NumberFormatter​(String decimalFormat)
        Creates a formatter using a DecimalFormat configured with the given format string.
        Parameters:
        decimalFormat - the format string
      • NumberFormatter

        public NumberFormatter​(NumberFormat format)
        Creates a formatter using the specified NumberFormat.
        Parameters:
        format - number format
    • Method Detail

      • nonNullFormat

        protected String nonNullFormat​(Object value)
        Description copied from class: AbstractCellFormatter
        Formats the specified value into a string appropriate for displaying in a table cell. Note that value is guaranteed to be non-null.
        Specified by:
        nonNullFormat in class AbstractCellFormatter
        Parameters:
        value - the value
        Returns:
        the formatted string