Package com.imsl
Class Messages
java.lang.Object
com.imsl.Messages
Retrieve and format message strings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatMessage(String bundleName, String key) A message is formatted, without arguments, using a MessageFormat string retrieved from the named resource bundle using the given key.static StringformatMessage(String bundleName, String key, Object[] arg) A message is formatted using a MessageFormat string retrieved from the named resource bundle using the given key.static voidthrowIllegalArgumentException(String packageName, String key, Object[] args) Throws an IllegalArgumentException with a formatted String argument.static voidthrowIllegalStateException(String packageName, String key, Object[] args) Throws an IllegalStateException with a formatted String argument.
-
Constructor Details
-
Messages
public Messages()
-
-
Method Details
-
formatMessage
A message is formatted using a MessageFormat string retrieved from the named resource bundle using the given key.- Parameters:
bundleName- is the resource bundle name.key- is the key of the MessageFormat string in the resource bundle.arg- is an array of arguments passed to the MessageFormat.format method.- Returns:
- the formatted message
-
formatMessage
A message is formatted, without arguments, using a MessageFormat string retrieved from the named resource bundle using the given key.- Parameters:
bundleName- is the resource bundle name.key- is the key of the MessageFormat string in the resource bundle.- Returns:
- the formatted message
-
throwIllegalArgumentException
Throws an IllegalArgumentException with a formatted String argument.- Parameters:
packageName- is the package from which the error is thrown. The resource bundle "ErrorMessages" in this package contains the error MessageFormat string.key- is the key of the MessageFormat string in the resource bundle.args- is an array of arguments passed to the MessageFormat.format method.
-
throwIllegalStateException
Throws an IllegalStateException with a formatted String argument.- Parameters:
packageName- is the package from which the error is thrown. The resource bundle "ErrorMessages" in this package contains the error MessageFormat string.key- is the key of the MessageFormat string in the resource bundle.args- is an array of arguments passed to the MessageFormat.format method.
-