public class CompositeFormat extends Format
Format.Field| Constructor and Description |
|---|
CompositeFormat(Format parser,
Format formatter)
Constructs a format that points its parseObject method to one implementation
and its format method to another.
|
| Modifier and Type | Method and Description |
|---|---|
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos)
Formats the input.
|
Format |
getFormatter()
Gets the parser Format implementation.
|
Format |
getParser()
Gets the parser Format implementation.
|
Object |
parseObject(String source,
ParsePosition pos)
Parses the input.
|
String |
reformat(String input)
Parses and then reformats a String.
|
clone, format, formatToCharacterIterator, parseObjectpublic CompositeFormat(Format parser, Format formatter)
parser - implementationformatter - implementationpublic StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
format in class Formatobj - the object to formattoAppendTo - the StringBuffer to append topos - the FieldPosition to use (or ignore).toAppendToFormat.format(Object, StringBuffer, FieldPosition)public Format getFormatter()
public Format getParser()
public Object parseObject(String source, ParsePosition pos)
parseObject in class Formatsource - 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 String reformat(String input) throws ParseException
input - String to reformatParseException - thrown by parseObject(String) callCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.