Class DefaultMessage

    • Constructor Detail

      • DefaultMessage

        public DefaultMessage​(MessageContext messageContext)
        Constructor
        Parameters:
        messageContext - message cotext
    • Method Detail

      • reset

        protected void reset()
        reset settings
      • argument

        public Message argument​(Serializable... arguments)
        Specified by:
        argument in interface Message
        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
      • template

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

        public String getTemplate()
        Specified by:
        getTemplate in interface Message
        Returns:
        the message key (or plain text) of the current message
      • toString

        public String toString​(String category)
        Description copied from interface: Message
        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 Message.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 "summary" and "detail" to allow a short and a more detailed explanation in Error, Warn and Info popups at the same time.

        Specified by:
        toString in interface Message
        Parameters:
        category - category
        Returns:
        Renders the Message as String
      • toString

        public String toString​(MessageContext messageContext)
        Description copied from interface: Message
        Renders the Message to a String, using an arbitrary MessageContext.
        Specified by:
        toString in interface Message
        Parameters:
        messageContext - message context
        Returns:
        Renders the Message as String
      • toString

        public String toString​(MessageContext messageContext,
                               String category)
        Description copied from interface: Message
        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 Message.getTemplate(). If no such template exists we will fall back to the version without the category String.
        Specified by:
        toString in interface Message
        Parameters:
        messageContext - message context object
        category - category
        Returns:
        Renders the Message as String
      • hashCode

        public int hashCode()
        Attention, the messageContext is deliberately not part of the equation!
        Overrides:
        hashCode in class Object
      • argumentArray

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

        public Message argument​(Collection<Serializable> arguments)
        Description copied from interface: Message
        Argument. Similar to the other argument methods, this one handles collections.
        Specified by:
        argument in interface Message
        Parameters:
        arguments - the arguments
        Returns:
        the message