Class Messages

java.lang.Object
org.ctan.site.services.upload.util.Messages
All Implemented Interfaces:
Iterable<List<String>>

public class Messages extends Object implements Iterable<List<String>>
This class is a container for messages. The messages may have the type ERROR, WARNING, or INFO.
  • Field Details

    • serialVersionUID

      public static final long serialVersionUID
      The field serialVersionUID contains the version number.
      See Also:
  • Constructor Details

    • Messages

      public Messages()
  • Method Details

    • errorMessage

      public static Messages errorMessage(String... msg)
      The method errorMessage provides means to create a new Messages instance populated with an error.
      Parameters:
      msg - the error attributes
      Returns:
      a new Messages
    • error

      public Messages error(String... msg)
      This method adds an error message with the given parameters.
      Parameters:
      msg - the parameters
      Returns:
      this
    • errorOrWarning

      public Messages errorOrWarning(String... msg)
      This method adds an error message with the given parameters.
      Parameters:
      msg - the parameters
      Returns:
      this
    • hasErrors

      public boolean hasErrors()
      The method hasErrors returns the indicator whether the messages contain at least one error message.
      Returns:
      the indicator whether errors are contained
    • info

      public Messages info(String... msg)
      This method adds an info message with the given parameters.
      Parameters:
      msg - the parameters
      Returns:
      this
    • infoMode

      public void infoMode()
      The method infoMode provides means to switch to info mode.
    • iterator

      public Iterator<List<String>> iterator()
      Specified by:
      iterator in interface Iterable<List<String>>
      See Also:
    • size

      public int size()
      The method size provides means to get the number of messages.
      Returns:
      the number of messages
    • toHtml

      public String toHtml()
      The method toHtml provides means to format the messages as HTML.
      Returns:
      the formatted messages
    • toString

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

      public String toText()
      The method toText provides means to format the messages as text.
      Returns:
      the formatted messages
    • warning

      public Messages warning(String... msg)
      This method adds a warning message with the given parameters.
      Parameters:
      msg - the parameters
      Returns:
      this