Interface Message

  • All Superinterfaces:
    Serializable
    All Known Implementing Classes:
    DefaultMessage

    public interface Message
    extends Serializable
    Basic interface for all messages.

    A Message is not a simple String but all the information needed to create those Strings for multiple situations. The situation is determined by the used MessageContext.

    • Method Detail

      • template

        Message template​(String messageTemplate)
        Parameters:
        messageTemplate - message key (or plain text) for the current message
        Returns:
        the current instance of the message builder to allow a fluent API
      • argument

        Message argument​(Serializable... arguments)
        Parameters:
        arguments - numbered and/or named argument(s) for the current message
        Returns:
        the current instance of the message builder to allow a fluent API
      • argumentArray

        Message argumentArray​(Serializable[] arguments)
        Argument array. Similar to argument except it is meant to handle an array being passed in via a chain.
        Parameters:
        arguments - the arguments
        Returns:
        the message
      • argument

        Message argument​(Collection<Serializable> arguments)
        Argument. Similar to the other argument methods, this one handles collections.
        Parameters:
        arguments - the arguments
        Returns:
        the message
      • getTemplate

        String getTemplate()
        Returns:
        the message key (or plain text) of the current message
      • getArguments

        Object[] getArguments()
        Returns:
        all named and numbered arguments
      • toString

        String toString​(MessageContext messageContext)
        Renders the Message to a String, using an arbitrary MessageContext.
        Parameters:
        messageContext - message context
        Returns:
        Renders the Message as String
      • toString

        String toString​(String category)
        Renders the Message to a String, using the MessageContext which created the Message. While resolving the message we will first search for a messageTemplate with the given category by just adding an underscore '_' and the category String to the getTemplate(). If no such template exists we will fall back to the version without the category String.

        DeltaSpike JSF messages e.g. distinguish between categories &quot;summary&quot; and &quot;detail&quot; to allow a short and a more detailed explanation in Error, Warn and Info popups at the same time.

        Parameters:
        category - category
        Returns:
        Renders the Message as String
      • toString

        String toString​(MessageContext messageContext,
                        String category)
        Renders the Message to a String, using an arbitrary MessageContext. While resolving the message we will first search for a messageTemplate with the given category by just adding an underscore '_' and the category String to the getTemplate(). If no such template exists we will fall back to the version without the category String.
        Parameters:
        messageContext - message context object
        category - category
        Returns:
        Renders the Message as String