public final class MessageFormatter extends Object
format(String,Object)
and
format(String,Object,Object)
for more details.Modifier and Type | Method and Description |
---|---|
static String |
format(String messagePattern,
Object argument)
Performs single argument substitution for the 'messagePattern' passed as
parameter.
|
static String |
format(String messagePattern,
Object arg1,
Object arg2)
/**
Performs a two argument substitution for the 'messagePattern' passed as
parameter.
|
public static String format(String messagePattern, Object argument)
For example, MessageFormatter.format("Hi {}.", "there");
will return the string "Hi there.".
messagePattern
- The message pattern which will be parsed and formattedargument
- The argument to be inserted instead of the formatting elementpublic static String format(String messagePattern, Object arg1, Object arg2)
For example, MessageFormatter.format("Hi {}. My name is {}.",
"there", "David");
will return the string
"Hi there. My name is David.".
messagePattern
- The message pattern which will be parsed and formattedarg1
- The first argument to replace the first formatting elementarg2
- The second argument to replace the second formatting elementCopyright © 2002-2017 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache Chainsaw, Chainsaw, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.