info.informatica.data
Class DataFormatter
java.lang.Object
info.informatica.text.FormatPrinter
info.informatica.data.DataFormatter
public final class DataFormatter
- extends info.informatica.text.FormatPrinter
Text formatting parser and printer.
This formatter emulates (not at 100%) the behavior of popular
printf C function, adding a few extensions.
Instead of a varargs-style argument as in C, it uses a dataset.
Synopsis:
DataFormatter fmt = new DataFormatter("Cost of item number ${code,7.1d} ("${item,-40.50s}) is ${price,8.2f}.");
Dataset dset = new ResultsetDataset();
dset.set(myResultSet);
String formatted_output = fmt.format(dset);
- Version:
- 1.01
- Author:
- amengual at informatica dot info
|
Method Summary |
String |
format(Dataset data)
Prints the values in data according to format
specifications. |
| Methods inherited from class info.informatica.text.FormatPrinter |
format, format, getFormats, hasArguments, sample, toString |
DataFormatter
public DataFormatter(String format)
throws info.informatica.text.ParsingException
- Throws:
info.informatica.text.ParsingException
DataFormatter
public DataFormatter(String format,
String nullStrText)
throws info.informatica.text.ParsingException
- Parameters:
format - the formatnullStrText - The String that will substitute null values
- Throws:
info.informatica.text.ParsingException
format
public String format(Dataset data)
throws DatasetException
- Prints the values in
data according to format
specifications.
- Parameters:
data - The dataset used to retrieve the values
- Returns:
- a formatted String with the proper values printed on it
- Throws:
DatasetException