Class CellNumberFormatter


  • public class CellNumberFormatter
    extends CellFormatter
    This class implements printing out a value using a number format.
    • Constructor Detail

      • CellNumberFormatter

        public CellNumberFormatter​(String format)
        Creates a new cell number formatter.
        Parameters:
        format - The format to parse.
      • CellNumberFormatter

        public CellNumberFormatter​(Locale locale,
                                   String format)
        Creates a new cell number formatter.
        Parameters:
        locale - The locale to use.
        format - The format to parse.
    • Method Detail

      • formatValue

        public void formatValue​(StringBuffer toAppendTo,
                                Object valueObject)
        Description copied from class: CellFormatter
        Format a value according the format string.

        NOTE: this method must be thread safe! In particular, if it uses a Format instance that is not thread safe, i.e. DateFormat, this method must be synchronized, either on the method, if the format is a final property, or on the format instance itself.

        Specified by:
        formatValue in class CellFormatter
        Parameters:
        toAppendTo - The buffer to append to.
        valueObject - The value to format.
      • simpleValue

        public void simpleValue​(StringBuffer toAppendTo,
                                Object value)
        Format a value according to the type, in the most basic way.

        NOTE: this method must be thread safe! In particular, if it uses a Format instance that is not thread safe, i.e. DateFormat, this method must be synchronized, either on the method, if the format is a final property, or on the format instance itself.

        For a number, this is "#" for integer values, and "#.#" for floating-point values.

        Specified by:
        simpleValue in class CellFormatter
        Parameters:
        toAppendTo - The buffer to append to.
        value - The value to format.