Package org.openpreservation.messages
Enum Class Messages
- All Implemented Interfaces:
Serializable
,Comparable<Messages>
,java.lang.constant.Constable
Utility class that handles creation of Message type instances, etc.
- Author:
- Carl Wilson carlwilson AT github
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic MessageFactory
Get a MessageFactory instance with the default property based bundle name and the default user localestatic MessageFactory
getInstance
(String bundleName) Get a MessageFactory instance with the requested property based bundle name and the default user localestatic MessageFactory
getInstance
(String bundleName, Locale locale) Get a MessageFactory instance with the requested property based bundle name and a specific localestatic Message
getMessageInstance
(String message) Create a new message instance with a DEFAULT_IDstatic Message
getMessageInstance
(String id, Message.Severity severity, String message) Create a Message instance with the give id and message valuestatic Message
getMessageInstance
(String id, Message.Severity severity, String message, String subMessage) Create a new Message instance with the given id, message and sub-messagestatic MessageLog
static MessageLog
messageLogInstance
(String path, List<Message> messages) static Messages
Returns the enum constant of this class with the specified name.static Messages[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
Ensure Messages is a singleton
-
-
Field Details
-
NO_ID
- See Also:
-
EMPTY_MESSAGE
- See Also:
-
DEFAULT_MESSAGE
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
getMessageInstance
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 messagemessage
- 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 messagemessage
- the message of the new messagesubMessage
- the sub-message of the new message- Returns:
- the new message instance
- Throws:
IllegalArgumentException
- if the id or message is null or empty
-
getInstance
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
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 filelocale
- 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
-
messageLogInstance
-