NumberCustomizerpublic class NumberCustomizer extends Object implements TableCustomizer
Fields Summary |
---|
NumberFormat | fmt |
Constructors Summary |
---|
public NumberCustomizer(Locale loc)
fmt = NumberFormat.getNumberInstance(loc);
|
Methods Summary |
---|
public boolean | accept(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 Element | display(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)));
}
|
|