Class NumberFormatter

    • Constructor Summary

      Constructors 
      Constructor Description
      NumberFormatter()
      Creates a formatter using the default format (no decimal places).
      NumberFormatter​(java.lang.String decimalFormat)
      Creates a formatter using a DecimalFormat configured with the given format string.
      NumberFormatter​(java.text.NumberFormat format)
      Creates a formatter using the specified NumberFormat.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String nonNullFormat​(java.lang.Object value)
      Formats the specified value into a string appropriate for displaying in a table cell.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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​(java.lang.String decimalFormat)
        Creates a formatter using a DecimalFormat configured with the given format string.
        Parameters:
        decimalFormat - the format string
      • NumberFormatter

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

      • nonNullFormat

        protected java.lang.String nonNullFormat​(java.lang.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