|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.informatica.text.format.FormatPrinter
public class 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 name-value Map.
Synopsis:
FormatPrinter fmt = new FormatPrinter("Cost of item number ${code,7.1d} ("${item,-40.50s}) is ${price,8.2f}.");
Map
m.put("item", "15-inch monitor");
m.put("code", new Integer(11209));
m.put("price", new Double(234.92));
String formatted_output = fmt.format(m);
| Constructor Summary | |
|---|---|
FormatPrinter(String format)
|
|
FormatPrinter(String format,
DecimalFormatSymbols symbols)
|
|
FormatPrinter(String format,
DecimalFormatSymbols symbols,
String nullStrText)
|
|
FormatPrinter(String format,
String nullStrText)
|
|
| Method Summary | |
|---|---|
String |
format(Map<String,? extends Object> env)
Prints the values in env according to format
specifications. |
String |
format(Object[] array)
Fast variant of the format method that sequentially prints
the values in an array according to format
specifications. |
String |
format(ResultSet env)
Prints the values in env according to format
specifications. |
DecimalFormatSymbols |
getDecimalFormatSymbols()
Gets the decimal format symbols. |
Iterator<TemplateItem> |
getFormats()
|
boolean |
hasArguments()
Does this object have template arguments, or is a plain String? |
String |
sample()
|
void |
setDecimalFormatSymbols(DecimalFormatSymbols symbols)
Sets the decimal format symbols. |
String |
toString()
Gives a String with the template items removed. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FormatPrinter(String format)
throws SpecParsingException
SpecParsingException
public FormatPrinter(String format,
DecimalFormatSymbols symbols)
throws SpecParsingException
SpecParsingException
public FormatPrinter(String format,
String nullStrText)
throws SpecParsingException
format - the formatnullStrText - The String that will substitute null values
SpecParsingException
public FormatPrinter(String format,
DecimalFormatSymbols symbols,
String nullStrText)
throws SpecParsingException
format - the formatnullStrText - The String that will substitute null values
SpecParsingException| Method Detail |
|---|
public String format(ResultSet env)
throws SQLException
env according to format
specifications.
env - The ResultSet used to retrieve the values
SQLExceptionpublic String format(Map<String,? extends Object> env)
env according to format
specifications.
env - The Map used to retrieve the values
public String format(Object[] array)
format method that sequentially prints
the values in an array according to format
specifications.
array - The array containing the values as found in the format.
public String sample()
public Iterator<TemplateItem> getFormats()
public boolean hasArguments()
public void setDecimalFormatSymbols(DecimalFormatSymbols symbols)
symbols - the new DecimalFormatSymbolspublic DecimalFormatSymbols getDecimalFormatSymbols()
public String toString()
toString in class ObjectObject.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||