public class CmsMessageContainer extends java.lang.Object implements java.io.Serializable, I_CmsMessageContainer
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.
I_CmsMessageBundle
,
Serialized FormModifier and Type | Field and Description |
---|---|
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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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() |
protected java.lang.Object[] m_args
protected I_CmsMessageBundle m_bundle
protected java.lang.String m_key
public CmsMessageContainer(I_CmsMessageBundle bundle, java.lang.String key)
bundle
- the OpenCms message bundle to read the message fromkey
- the message key to usepublic CmsMessageContainer(I_CmsMessageBundle bundle, java.lang.String key, java.lang.Object... args)
bundle
- the OpenCms message bundle to read the message fromkey
- the message key to useargs
- the message arguments to usepublic java.lang.Object[] getArgs()
public I_CmsMessageBundle getBundle()
public java.lang.String getKey()
public java.lang.String key()
public java.lang.String key(java.util.Locale locale)
key
in interface I_CmsMessageContainer
locale
- the locale to usepublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()