Interface Messages


public interface Messages
API to create Messages with different severity within the RequestContext. Messages provide additional information which may be added to the request's response.
See Also:
  • Method Details

    • info

      Message info(String messageOrKey, Object... params)
      Adds a new Message with severity Message.Severity.INFO to the current request with the given message text or format and format parameters. In case a key to a message format is passed, the request's locale is taken for localization.
      Parameters:
      messageOrKey - The message format or a key to a message format in the resource bundles.
      params - The parameters to fill the message format.
      Returns:
      The resulting Message object which can be adapted accordingly
    • success

      Message success(String messageOrKey, Object... params)
      Adds a new Message with severity Message.Severity.SUCCESS to the current request with the given message text or format and format parameters. In case a key to a message format is passed, the request's locale is taken for localization.
      Parameters:
      messageOrKey - The message format or a key to a message format in the resource bundles.
      params - The parameters to fill the message format.
      Returns:
      The resulting Message object which can be adapted accordingly
    • warn

      Message warn(String messageOrKey, Object... params)
      Adds a new Message with severity Message.Severity.WARNING to the current request with the given message text or format and format parameters. In case a key to a message format is passed, the request's locale is taken for localization.
      Parameters:
      messageOrKey - The message format or a key to a message format in the resource bundles.
      params - The parameters to fill the message format.
      Returns:
      The resulting Message object which can be adapted accordingly
    • error

      Message error(String messageOrKey, Object... params)
      Adds a new Message with severity Message.Severity.ERROR to the current request with the given message text or format and format parameters. In case a key to a message format is passed, the request's locale is taken for localization.
      Parameters:
      messageOrKey - The message format or a key to a message format in the resource bundles.
      params - The parameters to fill the message format.
      Returns:
      The resulting Message object which can be adapted accordingly
    • stream

      Stream<Message> stream()
      Returns a Stream of the added messages in the current request context
      Returns:
      The Stream of the added messages
    • throwIfError

      void throwIfError() throws ServiceException
      Throws a service exception, if error messages have been added to the current request.
      Throws:
      ServiceException - if there was at least one error message added to the current request