com.atlassian.confluence.util.i18n
Class Message

java.lang.Object
  extended by com.atlassian.confluence.util.i18n.Message

public final class Message
extends java.lang.Object

A user interface message consisting of a message key with optional arguments.

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.


Method Summary
 java.lang.Object[] getArguments()
          Returns the arguments to the message.
static Message getInstance(java.lang.String key)
          Constructs and returns an instance of a message with the given key and no arguments.
static Message getInstance(java.lang.String key, java.util.List arguments)
          Constructs and returns an instance of a message with the given key and arguments.
static Message getInstance(java.lang.String key, java.lang.Object... arguments)
          Constructs and returns an instance of a message with the given key and arguments.
 java.lang.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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static Message getInstance(java.lang.String key)
Constructs and returns an instance of a message with the given key and no arguments.

Parameters:
key - the i18n message key
Returns:
a new immutable Message instance

getInstance

public static Message getInstance(java.lang.String key,
                                  java.lang.Object... arguments)
Constructs and returns an instance of a message with the given key and arguments.

Parameters:
key - the i18n message key
arguments - the arguments which will be interpolated in the message value, like with MessageFormat
Returns:
a new immutable Message instance

getInstance

public static Message getInstance(java.lang.String key,
                                  java.util.List arguments)
Constructs and returns an instance of a message with the given key and arguments.

Parameters:
key - the i18n message key
arguments - the arguments which will be interpolated in the message value, like with MessageFormat
Returns:
a new immutable Message instance

getKey

public java.lang.String getKey()
Returns the message key, used for looking up the message in a localisation bundle.


getArguments

public java.lang.Object[] getArguments()
Returns the arguments to the message. These arguments might be interpolated in the message using MessageFormat, for instance.

Returns null if the message has no arguments.


hasArguments

public boolean hasArguments()
Returns true if the message has arguments defined, otherwise false.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2003-2013 Atlassian. All Rights Reserved.