public final class Message extends Object
Typically, messages will be presented to the user by looking up their value in a properties file (or "bundle"), and
applying MessageFormat
to the value with any optional arguments. However, this class
does not stipulate how the values held by this object might be used.
This class is immutable and thread-safe.
Modifier and Type | Method and Description |
---|---|
Object[] |
getArguments()
Returns the arguments to the message.
|
static Message |
getInstance(String key)
Constructs and returns an instance of a message with the given key and no arguments.
|
static Message |
getInstance(String key,
List arguments)
Constructs and returns an instance of a message with the given key and arguments.
|
static Message |
getInstance(String key,
Object... arguments)
Constructs and returns an instance of a message with the given key and arguments.
|
String |
getKey()
Returns the message key, used for looking up the message in a localisation bundle.
|
boolean |
hasArguments()
Returns true if the message has arguments defined, otherwise false.
|
String |
toString() |
public static Message getInstance(String key)
key
- the i18n message keypublic static Message getInstance(String key, Object... arguments)
key
- the i18n message keyarguments
- the arguments which will be interpolated in the message value, like with MessageFormatpublic static Message getInstance(String key, List arguments)
key
- the i18n message keyarguments
- the arguments which will be interpolated in the message value, like with MessageFormatpublic String getKey()
public Object[] getArguments()
Returns null if the message has no arguments.
public boolean hasArguments()
Copyright © 2003–2016 Atlassian. All rights reserved.