Class Message

  • All Implemented Interfaces:
    Serializable

    public class Message
    extends Object
    implements Serializable
    Message - encapsulates a simple message that is to be displayed to the user.
    Since:
    1.0.0
    Author:
    Yiannis Paschalidis
    See Also:
    Serialized Form
    • Field Detail

      • INFO_MESSAGE

        public static final int INFO_MESSAGE
        A message type that indicates that a message is an "informational message".
        See Also:
        Constant Field Values
      • WARNING_MESSAGE

        public static final int WARNING_MESSAGE
        A message type that indicates that a message is a "warning message".
        See Also:
        Constant Field Values
      • ERROR_MESSAGE

        public static final int ERROR_MESSAGE
        A message type that indicates that a message is an "error message".
        See Also:
        Constant Field Values
      • SUCCESS_MESSAGE

        public static final int SUCCESS_MESSAGE
        A message type that indicates that a message is a "success message".
        See Also:
        Constant Field Values
    • Constructor Detail

      • Message

        public Message​(String message,
                       Serializable... args)
        Creates an informational message.
        Parameters:
        message - the message text, using MessageFormat syntax.
        args - optional arguments for the message format string.
      • Message

        public Message​(int type,
                       String message,
                       Serializable... args)
        Creates a message.
        Parameters:
        type - the type of message.
        message - the message text, using MessageFormat syntax.
        args - optional arguments for the message format string.
    • Method Detail

      • getType

        public int getType()
        Returns:
        Returns the type.
      • setArgs

        public void setArgs​(Serializable... args)
        Sets the message format arguments.
        Parameters:
        args - the message arguments.
      • getArgs

        public Serializable[] getArgs()
        Returns:
        Returns the message format arguments.
      • getMessage

        public String getMessage()
        Returns:
        Returns the message.
      • setType

        public final void setType​(int type)
        Parameters:
        type - The type to set.
      • toString

        public String toString()
        Returns a string representation of this Message.
        Overrides:
        toString in class Object
        Returns:
        the message text.
      • equals

        public boolean equals​(Object obj)
        Indicates whether this Message is equal to the given object.
        Overrides:
        equals in class Object
        Parameters:
        obj - the object to compare against.
        Returns:
        true if the supplied object is a Message and is equal to this message.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
        Returns:
        the message's hash code.