Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public abstract class Format
- Object
- Format
ImplementsCloneable, Serializable
Known subtypesDateFormat, MessageFormat, NumberFormat
The base of the formats that turn locale sensitive values into text and
back: DateFormat, NumberFormat and MessageFormat.
A subclass implements format(Object, StringBuffer, FieldPosition) and
parseObject(String, ParsePosition); the one-argument forms are written
over them, as in the JDK.
Differences from the JDK
- No
clonehere:Object.clone()answersnullon the device for anything but an array, so every format of this package declares aclonethat copies its own fields. - No
formatToCharacterIterator: the device has noAttributedCharacterIterator.
Constructors
protected Format() |
Methods
public final String format(Object obj) | Formats an object to text. |
public abstract StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) | Formats an object, appending the text to toAppendTo, and reports the range the field pos names took. |
public abstract Object parseObject(String source, ParsePosition pos) | Parses an object from source starting at pos. |
public Object parseObject(String source)
throws ParseException | Parses an object from the beginning of source. |
Inherited methods
Constructor details
Format
protected Format()Method details
format
public final String format(Object obj)Formats an object to text.
Throws
IllegalArgumentException- if this format cannot format
obj
format
public abstract StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)Formats an object, appending the text to
toAppendTo, and reports the
range the field pos names took.Throws
IllegalArgumentException- if this format cannot format
obj
parseObject
public abstract Object parseObject(String source, ParsePosition pos)Parses an object from
source starting at pos. On success the index
of pos is moved past what was read; on failure it is left alone, the
error index is set and null is returned.parseObject
public Object parseObject(String source)
throws ParseExceptionParses an object from the beginning of
source.Throws
ParseException- if nothing at the beginning of
sourceparses