java.text
public class MessageFormat extends Format
Nested Class Summary | |
---|---|
static class | MessageFormat.Field |
Constructor Summary | |
---|---|
MessageFormat(String pattern)
Creates a new MessageFormat object with
the specified pattern
| |
MessageFormat(String pattern, Locale locale)
Creates a new MessageFormat object with
the specified pattern
|
Method Summary | |
---|---|
void | applyPattern(String newPattern)
Applies the specified pattern to this MessageFormat.
|
Object | clone()
Overrides Format.clone() |
boolean | equals(Object obj)
Overrides Format.equals(Object obj) |
static String | format(String pattern, Object... arguments)
A convinience method to format patterns.
|
StringBuffer | format(Object[] arguments, StringBuffer appendBuf, FieldPosition fp)
Returns the pattern with the formatted objects.
|
StringBuffer | format(Object objectArray, StringBuffer appendBuf, FieldPosition fpos)
Returns the pattern with the formatted objects. |
AttributedCharacterIterator | formatToCharacterIterator(Object arguments)
A convinience method to format patterns.
|
Format[] | getFormats()
Returns an array with the Formats for
the arguments. |
Format[] | getFormatsByArgumentIndex()
Return the formatters used sorted by argument index. |
Locale | getLocale()
Returns the locale. |
int | hashCode()
Overrides Format.hashCode() |
Object[] | parse(String sourceStr, ParsePosition pos)
Parse a string sourceStr against the pattern specified
to the MessageFormat constructor.
|
Object[] | parse(String sourceStr) |
Object | parseObject(String sourceStr, ParsePosition pos) |
void | setFormat(int variableNum, Format newFormat)
Sets the format for the argument at an specified
index.
|
void | setFormatByArgumentIndex(int argumentIndex, Format newFormat)
Set the format to used using the argument index number.
|
void | setFormats(Format[] newFormats)
Sets the formats for the arguments.
|
void | setFormatsByArgumentIndex(Format[] newFormats)
Set the format for argument using a specified array of formatters
which is sorted according to the argument index. |
void | setLocale(Locale loc)
Sets the locale.
|
String | toPattern()
Returns the pattern. |
Parameters: pattern The Pattern
Parameters: pattern The Pattern locale The Locale to use
Since: 1.4
Parameters: newPattern The Pattern
Parameters: pattern The pattern used when formatting. arguments The array containing the objects to be formatted.
Parameters: arguments The array containing the objects to be formatted. appendBuf The StringBuffer where the text is appened. fp A FieldPosition object (it is ignored).
Parameters: objectArray The object array to be formatted. appendBuf The StringBuffer where the text is appened. fpos A FieldPosition object (it is ignored).
Parameters: arguments The array containing the objects to be formatted.
setFormat
or setFormatByArgumentIndex
then it returns it at the right index. If not it uses the detected
formatters during a format
call. If nothing is known
about that argument index it just puts null at that position.
To get useful informations you may have to call format
at least once.
Returns: an array of formatters sorted by argument index.
sourceStr
against the pattern specified
to the MessageFormat constructor.
Parameters: sourceStr the string to be parsed. pos the current parse position (and eventually the error position).
Returns: the array of parsed objects sorted according to their argument number in the pattern.
Parameters: variableNum The index. newFormat The Format object.
Parameters: argumentIndex the argument index. newFormat the format to use for this argument.
Parameters: newFormats An array of Format objects.
Parameters: newFormats array containing the new formats to set.
Throws: NullPointerException if newFormats is null
Parameters: loc A Locale