Class MessageDefinition

  • Direct Known Subclasses:
    AuditLogMessageDefinition, ExceptionMessageDefinition

    public abstract class MessageDefinition
    extends Object
    MessageDefinition is a container that describes a single instance of a message. It is in fact the superclass of a message for an exception and for the audit log and as such, defines the values that are common to both. The concrete subclasses have the additional fields relevant to their specific definition.
    • Constructor Detail

      • MessageDefinition

        public MessageDefinition​(String messageId,
                                 String messageTemplate,
                                 String systemAction,
                                 String userAction)
        Constructor to save all of the fixed values of a message. This is typically populated from an Enum message set.
        Parameters:
        messageId - unique id of the message type.
        messageTemplate - template for the message text with placeholders for parameters.
        systemAction - description of the actions of the system when the situation arose.
        userAction - instructions on what to do next.
    • Method Detail

      • getMessageId

        public String getMessageId()
        Return the unique identifier for the message.
        Returns:
        string id
      • getMessageTemplate

        public String getMessageTemplate()
        Return the template of the message.
        Returns:
        string message text with placeholders
      • setMessageParameters

        public void setMessageParameters​(String... params)
        Set up the specific values that apply to this message instance.
        Parameters:
        params - list of string message inserts for the message template
      • getMessageParams

        public String[] getMessageParams()
        Return the array of values that apply to this message instance.
        Returns:
        list of string message inserts for the message template
      • getSystemAction

        public String getSystemAction()
        Returns a description of the action taken by the system when the condition that caused this exception was detected.
        Returns:
        systemAction String
      • getUserAction

        public String getUserAction()
        Returns instructions on what to do next given that this situation has occurred.
        Returns:
        userAction String
      • toString

        public String toString()
        JSON-style toString.
        Overrides:
        toString in class Object
        Returns:
        list of properties and their values.