|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.text.Format org.apache.commons.lang.text.CompositeFormat
Formats using one formatter and parses using a different formatter. An example of use for this would be a webapp where data is taken in one way and stored in a database another way.
Nested Class Summary |
Nested classes inherited from class java.text.Format |
java.text.Format.Field |
Constructor Summary | |
CompositeFormat(java.text.Format parser,
java.text.Format formatter)
Create a format that points its parseObject method to one implementation and its format method to another. |
Method Summary | |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Uses the formatter Format instance. |
java.text.Format |
getFormatter()
Provides access to the parser Format implementation. |
java.text.Format |
getParser()
Provides access to the parser Format implementation. |
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Uses the parser Format instance. |
java.lang.String |
reformat(java.lang.String input)
Utility method to parse and then reformat a String. |
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 CompositeFormat(java.text.Format parser, java.text.Format formatter)
parser
- implementationformatter
- implementationMethod Detail |
public java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
obj
- the object to formattoAppendTo
- the StringBuffer
to append topos
- the FieldPosition to use (or ignore).
toAppendTo
Format.format(Object, StringBuffer, FieldPosition)
public java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
source
- the String sourcepos
- the ParsePosition containing the position to parse from, will
be updated according to parsing success (index) or failure
(error index)
Format.parseObject(String, ParsePosition)
public java.text.Format getParser()
public java.text.Format getFormatter()
public java.lang.String reformat(java.lang.String input) throws java.text.ParseException
input
- String to reformat
java.text.ParseException
- thrown by parseObject(String) call
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |