Class CmsMessageContainer

java.lang.Object
org.opencms.i18n.CmsMessageContainer
All Implemented Interfaces:
Serializable, I_CmsMessageContainer

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
See Also:
  • Field Details

  • Constructor Details

    • CmsMessageContainer

      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, String key, 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 Details

    • getArgs

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

      Returns:
      the message arguments to use
    • getBundle

      Returns the message bundle used by this container.

      Returns:
      the message bundle used by this container
    • getKey

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

      Returns:
      the message key to use
    • key

      public 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 String key(Locale locale)
      Returns the localized message described by this container for the given locale.

      Specified by:
      key in interface I_CmsMessageContainer
      Parameters:
      locale - the locale to use
      Returns:
      the localized message described by this container for the given locale
    • toString

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