Class AdaptiveNumberFormatter

java.lang.Object
net.sf.basedb.util.formatter.NumberFormatter
net.sf.basedb.util.formatter.AdaptiveNumberFormatter
All Implemented Interfaces:
ExcelFormatter<Number,Number>, Formatter<Number>

public class AdaptiveNumberFormatter extends NumberFormatter
Formats a number for output on a web page adapting thwe number of decimals depending on the order of magnitude of the value. The precision value is defined to be the number of decimals to use for values between 1 and 10 (not inclusive). The number of decimals are then increase or decreased for each order of magnitude that the value get smaller or larger.
Since:
3.2.2
Author:
nicklas
Last modified
$Date$
  • Field Details

    • precision

      private final int precision
  • Constructor Details

    • AdaptiveNumberFormatter

      public AdaptiveNumberFormatter(int precision, boolean doubleValues)
      Create a new number formatter.
      Parameters:
      precision - The number of decimals to display for values between 1 and 10 (for lower and higher values the number of decimals is adjusted), or a negative value to display all decimals
      doubleValues - If the NumberFormatter.parseString(String) should return double or float values
      See Also:
  • Method Details