|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.i18n.Format
net.rim.device.api.i18n.MessageFormat
public class MessageFormat
Formats and parses messages in a locale-sensitive manner.
Locale-specific formatting is passed on to other formatter objects that inserted into this formatter's pattern (this class supports the string, date, and time element formats).
Compatible with java.text.MessageFormat in Java's standard edition.
Constructor Summary | ||
---|---|---|
MessageFormat(String pattern)
Constructs new MessageFormat instance with the given pattern string. |
Method Summary | ||
---|---|---|
void |
applyPattern(String newPattern)
Applies a new pattern string to this formatter. |
|
StringBuffer |
format(Object arguments,
StringBuffer result,
FieldPosition ignored)
Retrieves formatted string representation of argument list. |
|
static String |
format(String pattern,
Object[] arguments)
Retrieves formatted string represenation of argument list, with provided pattern string. |
|
int[] |
getFields()
Retrieves ordered list of fields. |
|
Format[] |
getFormats()
Retrieves list of sub-formatters. |
|
Locale |
getLocale()
Retrieves current locale. |
|
int |
hashCode()
Returns a hash code for this object. |
|
void |
setFormat(int variable,
Format format)
Assign a single sub-formatter to a particular component in this formatter's pattern string. |
|
void |
setFormats(Format[] formats)
Sets new list of sub-formatters. |
|
void |
setLocale(Locale locale)
Sets the locale. |
Methods inherited from class net.rim.device.api.i18n.Format |
---|
format |
Methods inherited from class java.lang.Object |
---|
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MessageFormat(String pattern)
pattern
- Pattern string for this formatter.Method Detail |
---|
public void applyPattern(String newPattern)
newPattern
- New pattern string to use with this formatter.public final StringBuffer format(Object arguments, StringBuffer result, FieldPosition ignored)
format
in class Format
arguments
- Argument list to be formatted. This must always be an array.result
- String buffer to hold the formatted results.ignored
- Ignored parameter.
public static String format(String pattern, Object[] arguments)
This method lets you retrieve formatted argument lists without having to instantiate a message formatter.
pattern
- Pattern string that formatter should use.arguments
- Argument list to be formatted.
public int[] getFields()
getFields
in class Format
public Format[] getFormats()
This class uses sub-formatters to assist in locale-specific formatting of message components. This method retrieves this formatter's list of sub-formatters.
public Locale getLocale()
public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
Hashtable
public void setFormats(Format[] formats)
This formatter employs a set of sub-formatters to provide locale-specific formatting of message components. Use this method to provide this formatter with a list of those sub-formatters.
formats
- New list of sub-formatters this formatter should employ.public void setFormat(int variable, Format format)
Each variable in this formatter's pattern string stands for a particular message component. Treat the pattern string as a zero-based list of variables in order to determine which variable number you should pass to this method.
variable
- Offset (past the first variable in the pattern string) of
the pattern string variable to be assigned the sub-formatter.format
- Sub-formatter in charge of formatting the message
component in question.public void setLocale(Locale locale)
Invoke this method to set this formatter to a locale other than the system default locale.
theLocale
- New locale this formatter should use.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.