|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.text.Format com.gridsystems.utils.text.ComposedFormat
public class ComposedFormat
Format implementation that performs a "chained" format over the passed object.
The internal formatters specified at construction time are sequentially invoked to perform the formatting in the same order they are in the array.
For example, an following code:
Format f = new ComposedFormat(
new DecimalFormat("#,##0.00"),
new MessageFormat("<span style='color:red'>{0}</span>");
);
System.out.println(f.format(new Integer(3500)));
will produce the next output:
<span style='color:red'>3.500,00</span>
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.text.Format |
---|
java.text.Format.Field |
Constructor Summary | |
---|---|
ComposedFormat(java.text.Format... ff)
Creates an instance with the specified array of internal formatters. |
Method Summary | |
---|---|
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Formats an object and appends the resulting text to a given string buffer. |
java.lang.Object |
parseObject(java.lang.String s,
java.text.ParsePosition pos)
Not implemented. |
Methods inherited from class java.text.Format |
---|
clone, format, formatToCharacterIterator, parseObject |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ComposedFormat(java.text.Format... ff)
ff
- The array of internal formattersMethod Detail |
---|
public java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.Format
obj
- The object to formattoAppendTo
- Where the text is to be appendedpos
- A FieldPosition
identifying a field
in the formatted text
toAppendTo
,
with formatted text appended
java.lang.NullPointerException
- if toAppendTo
is null
java.lang.IllegalArgumentException
- if any of the internal Formats cannot
format the given objectpublic java.lang.Object parseObject(java.lang.String s, java.text.ParsePosition pos)
parseObject
in class java.text.Format
s
- the stringpos
- the parse position
java.lang.UnsupportedOperationException
- always
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |