|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.adfnmc.util.NamedMessageFormat
public class NamedMessageFormat
The NamedMessageFormat class is a greatly reduced version of the java.text.MessageFormat class, supporting named-parameter replacement instead of index-based replacement.
The only syntax supported by this class is simple name-based replacement, namely:
some{first}text{second}here{more-complicated}andthereas well as escaping using single quotes. Like MessageFormat, a single quote must be represented using two consecutive single quotes, but the contents of any text between single quotes will not be interpreted. So, the following pattern could be used to include a left bracket:
some'{'text{first}
The names of the parameters can contain any characters other than single quotes and right braces. Single-quote escaping is also not permitted within keys, so the following is illegal:
some text{fir'{'st}
Constructor Summary | |
---|---|
NamedMessageFormat(java.lang.String formatString)
Creates a NamedMessageFormat based on the given format string. |
Method Summary | |
---|---|
java.lang.String |
format(java.util.Hashtable parameters)
Formats the given Map of strings based on the initial pattern. |
java.lang.String |
format(java.util.Hashtable parameters,
int parameterSize)
Formats the given Map of strings based on the initial pattern. |
static java.lang.String |
formatMsg(java.lang.String message,
java.util.Hashtable parameters)
Takes the given message and replaces any named tokens in the message with the value from the tokens map. |
static java.lang.String |
formatMsgMixed(java.lang.String message,
java.util.Hashtable formatValues,
java.util.Hashtable noformatValues)
/** Takes the given message and replaces any named tokens in the message that are included in the parameters map and replaces them with the value in the parameter map. |
static java.lang.String |
formatMsgPlain(java.lang.String message,
java.util.Hashtable parameters)
Takes the given message and replaces any named tokens in the message that are included in the parameters map and replaces them with the value in the parameter map. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NamedMessageFormat(java.lang.String formatString)
Method Detail |
---|
public java.lang.String format(java.util.Hashtable parameters)
parameters
- a Map of key/value String pairspublic java.lang.String format(java.util.Hashtable parameters, int parameterSize)
parameters
- a Map of key/value String pairsparameterSize
- the accumulated size of the parameters, if known. Pass zero for an unknown size. This
allows for optimizing to reduce buffer reallocation.public static java.lang.String formatMsg(java.lang.String message, java.util.Hashtable parameters)
MessageFormat
so parameters whose object is not a string
already will be formatted according to the default locale (eg, a number like 1000 may become
1,000)
message
- the message string with tokens in placeparameters
- parameters map of tokens to objects
public static java.lang.String formatMsgPlain(java.lang.String message, java.util.Hashtable parameters)
message
- the message string with tokens in placeparameters
- map of tokens to objects
public static java.lang.String formatMsgMixed(java.lang.String message, java.util.Hashtable formatValues, java.util.Hashtable noformatValues)
message
- the message string with tokens in placeformatValues
- map of tokens to objects that should be formattednoformatValues
- map of tokens to objects that should not be formatted
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |