Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.pivot.table
Class DefaultTableFormatter

java.lang.Object
  extended by com.citra.pivot.table.DefaultTableFormatter
All Implemented Interfaces:
TableFormatter

public class DefaultTableFormatter
extends Object
implements TableFormatter

DefaultTableFormatter is the default TableFormatter. It formats objects according to their type, for which purpose, there are 3 different number formats:

  • currencyFormat for CURRENCY Olap types
  • doubleFormat for DOUBLE Olap types
  • numberFormat for all other number types

  • In other cases, the object's string value is returned.


    Field Summary
    protected  NumberFormat currencyFormat
              the number format for currency values
    protected  NumberFormat doubleFormat
              the number format for double values
    protected  NumberFormat numberFormat
              the number format for numbers other than double and currency
     
    Constructor Summary
    DefaultTableFormatter()
              Constructs a DefaultTableFormatter.
     
    Method Summary
     String format(Object value, TableMeasure measure, Locale locale)
              Evaluates the string representation of a value, given its measure and a locale.
     NumberFormat getCurrencyFormat()
              Retrieves the format for currency values.
     NumberFormat getDoubleFormat()
              Retrieves the format for double values.
     NumberFormat getNumberFormat()
              Retrieves the format for numbers other than double and currency.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    numberFormat

    protected NumberFormat numberFormat
    the number format for numbers other than double and currency


    doubleFormat

    protected NumberFormat doubleFormat
    the number format for double values


    currencyFormat

    protected NumberFormat currencyFormat
    the number format for currency values

    Constructor Detail

    DefaultTableFormatter

    public DefaultTableFormatter()
    Constructs a DefaultTableFormatter.

    Method Detail

    format

    public String format(Object value,
                         TableMeasure measure,
                         Locale locale)
    Evaluates the string representation of a value, given its measure and a locale.

    Specified by:
    format in interface TableFormatter
    Parameters:
    value - the value to format
    measure - the measure to which the value belongs
    locale - a locale to format into
    Returns:
    the formatted string

    getCurrencyFormat

    public NumberFormat getCurrencyFormat()
    Retrieves the format for currency values.

    Returns:
    the currency format

    getDoubleFormat

    public NumberFormat getDoubleFormat()
    Retrieves the format for double values.

    Returns:
    the double format

    getNumberFormat

    public NumberFormat getNumberFormat()
    Retrieves the format for numbers other than double and currency.

    Returns:
    the number format

    Copyright © 2011 Citra Technologies. All Rights Reserved.