|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.aries.util.nls.MessageUtil
public final class MessageUtil
This is a helper class for loading messages for logging and exception messages. It supports translating the message into the default Locale. It works out the calling Bundle and uses it to load any resources. If the resource bundle is of type java.properties then it tries to find the bundle first via the bundle getResources method, then via the getEntry method. If it is of type java.class then it'll use the bundle to load the class.
Method Summary | |
---|---|
static MessageUtil |
createMessageUtil(Bundle b,
String baseName)
This method loads the resource bundle backing the MessageUtil from the provided Bundle. |
static MessageUtil |
createMessageUtil(Class<?> context,
String baseName)
Loads the MessageUtil using the given context. |
static MessageUtil |
createMessageUtil(String baseName)
This method uses the Bundle associated with the caller of this method. |
String |
getMessage(String key,
Object... inserts)
This method translates the message and puts the inserts into the message before returning it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public String getMessage(String key, Object... inserts)
key
- the message key.inserts
- the inserts into the resolved message.
public static MessageUtil createMessageUtil(Class<?> context, String baseName)
context
- the bundle this class is in will be used to resolve the base name.baseName
- the resource bundle base name
MissingResourceException
- If the resource bundle cannot be locatedpublic static MessageUtil createMessageUtil(String baseName)
baseName
- the resource bundle base name
MissingResourceException
- If the resource bundle cannot be locatedpublic static MessageUtil createMessageUtil(Bundle b, String baseName)
b
- the bundle to load the resource bundle frombaseName
- the resource bundle base name
MissingResourceException
- If the resource bundle cannot be located
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |