|
||||||||||
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
public class 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/interfaces inherited from class java.text.Format |
---|
Format.Field |
Constructor Summary | |
---|---|
CompositeFormat(Format parser,
Format formatter)
Create a format that points its parseObject method to one implementation and its format method to another. |
Method Summary | |
---|---|
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos)
Uses the formatter Format instance. |
Format |
getFormatter()
Provides access to the parser Format implementation. |
Format |
getParser()
Provides access to the parser Format implementation. |
Object |
parseObject(String source,
ParsePosition pos)
Uses the parser Format instance. |
String |
reformat(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(Format parser, Format formatter)
parser
- implementationformatter
- implementationMethod Detail |
---|
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
format
in class Format
Format.format(Object, StringBuffer, FieldPosition)
public Object parseObject(String source, ParsePosition pos)
parseObject
in class Format
Format.parseObject(String, ParsePosition)
public Format getParser()
public Format getFormatter()
public String reformat(String input) throws ParseException
input
- String to reformat
ParseException
- thrown by parseObject(String) call
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |