Enum Class Messages

java.lang.Object
java.lang.Enum<Messages>
org.openpreservation.messages.Messages
All Implemented Interfaces:
Serializable, Comparable<Messages>, java.lang.constant.Constable

public enum Messages extends Enum<Messages>
Utility class that handles creation of Message type instances, etc.
Author:
Carl Wilson carlwilson AT github
  • Enum Constant Details

    • INSTANCE

      public static final Messages INSTANCE
      Ensure Messages is a singleton
  • Field Details

  • Method Details

    • values

      public static Messages[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Messages valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getMessageInstance

      public static Message getMessageInstance(String message) throws IllegalArgumentException
      Create a new message instance with a DEFAULT_ID
      Parameters:
      message - the message of the new message
      Returns:
      the new message instance
      Throws:
      IllegalArgumentException - if the id or message is null or empty
    • getMessageInstance

      public static Message getMessageInstance(String id, Message.Severity severity, String message) throws IllegalArgumentException
      Create a Message instance with the give id and message value
      Parameters:
      id - the id of the new message
      message - the message of the new message
      Returns:
      the new message instance
      Throws:
      IllegalArgumentException - if the id or message is null or empty
    • getMessageInstance

      public static Message getMessageInstance(String id, Message.Severity severity, String message, String subMessage) throws IllegalArgumentException
      Create a new Message instance with the given id, message and sub-message
      Parameters:
      id - the id of the new message
      message - the message of the new message
      subMessage - the sub-message of the new message
      Returns:
      the new message instance
      Throws:
      IllegalArgumentException - if the id or message is null or empty
    • getInstance

      public static MessageFactory getInstance() throws IllegalArgumentException
      Get a MessageFactory instance with the default property based bundle name and the default user locale
      Returns:
      a new MessageFactory instance backed by the bundle property file.
      Throws:
      IllegalArgumentException - if the bundle name is empty or the message bundle can't be located
    • getInstance

      public static MessageFactory getInstance(String bundleName) throws IllegalArgumentException
      Get a MessageFactory instance with the requested property based bundle name and the default user locale
      Parameters:
      bundleName - the fully qualified resource path for the message bundle property file
      Returns:
      a new MessageFactory instance backed by the bundle property file.
      Throws:
      IllegalArgumentException - if the bundle name is empty or the message bundle can't be located
    • getInstance

      public static MessageFactory getInstance(String bundleName, Locale locale) throws IllegalArgumentException
      Get a MessageFactory instance with the requested property based bundle name and a specific locale
      Parameters:
      bundleName - the fully qualified resource path for the message bundle property file
      locale - the locale for the message bundle
      Returns:
      a new MessageFactory instance backed by the bundle property file.
      Throws:
      IllegalArgumentException - if the bundle name is empty or the message bundle can't be located
    • messageLogInstance

      public static MessageLog messageLogInstance()
    • messageLogInstance

      public static MessageLog messageLogInstance(String path, List<Message> messages)