FileDocCategorySizeDatePackage
NumberCustomizer.javaAPI DocExample1397Thu Apr 05 20:32:50 BST 2001None

NumberCustomizer

public class NumberCustomizer extends Object implements TableCustomizer

Fields Summary
NumberFormat
fmt
Constructors Summary
public NumberCustomizer(Locale loc)

    fmt = NumberFormat.getNumberInstance(loc);
  
Methods Summary
public booleanaccept(int columnType, java.lang.String columnTypeName, java.lang.String columnName, java.sql.ResultSet rs, int index)

    return (columnType == Types.TINYINT ||
            columnType == Types.SMALLINT ||
            columnType == Types.INTEGER ||
            columnType == Types.BIGINT ||
            columnType == Types.REAL ||
            columnType == Types.FLOAT ||
            columnType == Types.DOUBLE);
  
public Elementdisplay(int columnType, java.lang.String columnTypeName, java.lang.String columnName, java.sql.ResultSet rs, int index)

    // Print the number using the specified locale
    if (columnType == Types.TINYINT ||
        columnType == Types.SMALLINT ||
        columnType == Types.INTEGER ||
        columnType == Types.BIGINT) {
      return new StringElement(fmt.format(rs.getLong(index)));
    }
    else {
      return new StringElement(fmt.format(rs.getDouble(index)));
    }