org.apache.hivemind.impl
Class MessageFormatter
java.lang.Object
|
+--org.apache.hivemind.impl.MessageFormatter
- public class MessageFormatter
- extends java.lang.Object
A wrapper around ResourceBundle
that makes
it easier to access and format messages.
- Author:
- Howard Lewis Ship
Constructor Summary |
MessageFormatter(java.lang.Class referenceClass,
java.lang.String name)
|
MessageFormatter(org.apache.commons.logging.Log log,
java.lang.Class referenceClass,
java.lang.String name)
|
MessageFormatter(org.apache.commons.logging.Log log,
java.util.ResourceBundle bundle)
|
MessageFormatter(org.apache.commons.logging.Log log,
java.lang.String bundleName)
|
Method Summary |
java.lang.String |
format(java.lang.String key,
java.lang.Object arg)
|
java.lang.String |
format(java.lang.String key,
java.lang.Object[] args)
Formats a message using the key to obtain a pattern, and passing the arguments. |
java.lang.String |
format(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2)
|
java.lang.String |
format(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
|
java.lang.String |
getMessage(java.lang.String key)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MessageFormatter
public MessageFormatter(org.apache.commons.logging.Log log,
java.util.ResourceBundle bundle)
MessageFormatter
public MessageFormatter(java.lang.Class referenceClass,
java.lang.String name)
MessageFormatter
public MessageFormatter(org.apache.commons.logging.Log log,
java.lang.Class referenceClass,
java.lang.String name)
MessageFormatter
public MessageFormatter(org.apache.commons.logging.Log log,
java.lang.String bundleName)
getMessage
public java.lang.String getMessage(java.lang.String key)
format
public java.lang.String format(java.lang.String key,
java.lang.Object arg)
format
public java.lang.String format(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2)
format
public java.lang.String format(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
format
public java.lang.String format(java.lang.String key,
java.lang.Object[] args)
- Formats a message using the key to obtain a pattern, and passing the arguments.
It is common to pass an exception instance as an arg. Those are treated specially:
The exception instance is replaced with its message Throwable.getMessage()
. If the
message is blank (null or empty), then the exception's class name is used.