|
Service Activator Toolkit
Version 1.1.0 (20081206) |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.soda.sat.core.util.MessageFormatter
public class MessageFormatter
The MessageFormatter class provides a ways for building
an internationalized String based on a message pattern. The
message pattern contains variable such as {0}, {1},
{2}, etc, that are populated at runtime.
For example, a message pattern such as "The rain in {0} falls mainly on
the {1}." could be formatted as follows:
The
String pattern = "The rain in {0} falls mainly on the {1}.";
Object[] values = Object[] {
"Spain", "plain"
};
String message = MessageFormatter.format(pattern, values);
System.out.println(message);
message will be initialized to "The rain in Spain
falls mainly on the plain.".
| Method Summary | |
|---|---|
static String |
format(String pattern,
Object value)
Create a formatted string using the specified pattern and object. |
static String |
format(String pattern,
Object[] values)
Create a formatted string using the specified pattern and an array of objects. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String format(String pattern,
Object value)
{0} that will be
replaced with a String representation of the specified
object. The place-holder may appear in the pattern any number of times.
The object is converted to a String using its
toString() method. This is a convenience method
that simply calls format(String,Object[]).
pattern - A pattern containing the place-holder {0}.value - The value to be inserted at the place-holder.
String.
public static String format(String pattern,
Object[] values)
{0}, {1}, {2}, etc, that will be
replaced with a String representation of the objects at the
corresponding index in the specified object array. The place-holders may
appear in the pattern any number of times. The objects are converted to
a String using its toString() method.
pattern - A pattern containing place-holders.values - The objects to be inserted at the place-holders.
String.
|
Service Activator Toolkit
Version 1.1.0 (20081206) |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright © 2001, 2008 IBM Corporation and others. All Rights Reserved.