org.opencms.i18n
Class CmsMessageContainer

java.lang.Object
  extended by org.opencms.i18n.CmsMessageContainer
All Implemented Interfaces:
java.io.Serializable

public class CmsMessageContainer
extends java.lang.Object
implements java.io.Serializable

Contains a localized message key, it's arguments and a I_CmsMessageBundle.

Used for delaying the actual message lookup from the bundle to the time the message is displayed, not generated. This is used for localizing internal OpenCms messages. If a message is generated internally by OpenCms, at the time no information about the context of the current user may be available. The message is therefore passed to the class generating the output, where a user context usually exists. Finally, the message is rendered with the locale of the available user, or the OpenCms default locale if no user is available.

Since:
6.0.0
Version:
$Revision: 1.15 $
Author:
Alexander Kandzior
See Also:
I_CmsMessageBundle, Serialized Form

Field Summary
protected  java.lang.Object[] m_args
          The message arguments to use.
protected  I_CmsMessageBundle m_bundle
          The OpenCms message bundle to read the message from.
protected  java.lang.String m_key
          The message key to use.
 
Constructor Summary
CmsMessageContainer(I_CmsMessageBundle bundle, java.lang.String key)
          Creates a new message container for a key without arguments.
CmsMessageContainer(I_CmsMessageBundle bundle, java.lang.String key, java.lang.Object[] args)
          Creates a new message container.
 
Method Summary
 java.lang.Object[] getArgs()
          Returns the message arguments to use.
 I_CmsMessageBundle getBundle()
          Returns the message bundle used by this container.
 java.lang.String getKey()
          Returns the message key to use.
 java.lang.String key()
          Returns the localized message described by this container for the OpenCms default locale.
 java.lang.String key(java.util.Locale locale)
          Returns the localized message described by this container for the given locale.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_args

protected java.lang.Object[] m_args
The message arguments to use.


m_bundle

protected I_CmsMessageBundle m_bundle
The OpenCms message bundle to read the message from.


m_key

protected java.lang.String m_key
The message key to use.

Constructor Detail

CmsMessageContainer

public CmsMessageContainer(I_CmsMessageBundle bundle,
                           java.lang.String key)
Creates a new message container for a key without arguments.

Parameters:
bundle - the OpenCms message bundle to read the message from
key - the message key to use

CmsMessageContainer

public CmsMessageContainer(I_CmsMessageBundle bundle,
                           java.lang.String key,
                           java.lang.Object[] args)
Creates a new message container.

Parameters:
bundle - the OpenCms message bundle to read the message from
key - the message key to use
args - the message arguments to use
Method Detail

getArgs

public java.lang.Object[] getArgs()
Returns the message arguments to use.

Returns:
the message arguments to use

getBundle

public I_CmsMessageBundle getBundle()
Returns the message bundle used by this container.

Returns:
the message bundle used by this container

getKey

public java.lang.String getKey()
Returns the message key to use.

Returns:
the message key to use

key

public java.lang.String key()
Returns the localized message described by this container for the OpenCms default locale.

Returns:
the localized message described by this container for the OpenCms default locale

key

public java.lang.String key(java.util.Locale locale)
Returns the localized message described by this container for the given locale.

Parameters:
locale - the locale to use
Returns:
the localized message described by this container for the given locale

toString

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