public class MessageFormat extends Format
Format.Field
Constructor and Description |
---|
MessageFormat(String pattern) |
MessageFormat(String pattern,
Locale locale) |
Modifier and Type | Method and Description |
---|---|
void |
applyPattern(String pattern) |
Object |
clone()
Returns a copy of this
Format instance. |
boolean |
equals(Object o)
Default object equality (is identity).
|
StringBuffer |
format(Object[] args,
StringBuffer dest,
FieldPosition pos) |
StringBuffer |
format(Object obj,
StringBuffer dest,
FieldPosition pos)
Appends the specified object to the specified string buffer using the
rules of this format.
|
static String |
format(String pattern,
Object[] args) |
Format[] |
getFormats() |
Locale |
getLocale() |
int |
hashCode()
The (default) object hashcode: for transient objects this is simply the
address of the instance in memory, for persistent objects it is the
address at which the instance was first created (maybe in a previous
activation of the VM).
|
Object[] |
parse(String src) |
Object[] |
parse(String src,
ParsePosition pos) |
Object |
parseObject(String source,
ParsePosition pos)
Parses the specified string starting at the index specified by
position . |
void |
setFormat(int num,
Format format) |
void |
setFormats(Format[] formats) |
void |
setLocale(Locale loc) |
String |
toPattern() |
format, formatToCharacterIterator, parseObject
public MessageFormat(String pattern) throws IllegalArgumentException
IllegalArgumentException
public MessageFormat(String pattern, Locale locale) throws IllegalArgumentException
IllegalArgumentException
public void applyPattern(String pattern) throws IllegalArgumentException
IllegalArgumentException
public Object clone()
Format
Format
instance.public boolean equals(Object o)
Object
public final StringBuffer format(Object[] args, StringBuffer dest, FieldPosition pos)
public final StringBuffer format(Object obj, StringBuffer dest, FieldPosition pos)
Format
field
is an input/output parameter. If its field
member contains an enum value specifying a field on input, then its
beginIndex
and endIndex
members will be updated with the
text offset of the first occurrence of this field in the formatted text.
public Format[] getFormats()
public Locale getLocale()
public int hashCode()
Object
public Object[] parse(String src, ParsePosition pos)
public Object[] parse(String src) throws ParseException
ParseException
public Object parseObject(String source, ParsePosition pos)
Format
position
. If the string is successfully parsed then the index of
the ParsePosition
is updated to the index following the parsed
text. On error, the index is unchanged and the error index of
ParsePosition
is set to the index where the error occurred.parseObject
in class Format
null
if there is
an error.public void setFormat(int num, Format format)
public void setFormats(Format[] formats)
public void setLocale(Locale loc)
public String toPattern()