public class ExceptionContext
extends java.lang.Object
implements java.io.Serializable
ExceptionContext
interface.
All Commons Math exceptions delegate the interface's methods to this class.Constructor and Description |
---|
ExceptionContext(java.lang.Throwable throwable)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addMessage(Localizable pattern,
java.lang.Object... arguments)
Adds a message.
|
java.util.Set<java.lang.String> |
getKeys()
Gets all the keys stored in the exception
|
java.lang.String |
getLocalizedMessage()
Gets the message in the default locale.
|
java.lang.String |
getMessage()
Gets the default message.
|
java.lang.String |
getMessage(java.util.Locale locale)
Gets the message in a specified locale.
|
java.lang.String |
getMessage(java.util.Locale locale,
java.lang.String separator)
Gets the message in a specified locale.
|
java.lang.Throwable |
getThrowable()
Get a reference to the exception to which the context relates.
|
java.lang.Object |
getValue(java.lang.String key)
Gets the value associated to the given context key.
|
void |
setValue(java.lang.String key,
java.lang.Object value)
Sets the context (key, value) pair.
|
public ExceptionContext(java.lang.Throwable throwable)
throwable
- the exception this context refers toopublic java.lang.Throwable getThrowable()
public void addMessage(Localizable pattern, java.lang.Object... arguments)
pattern
- Message pattern.arguments
- Values for replacing the placeholders in the message
pattern.public void setValue(java.lang.String key, java.lang.Object value)
key
- Context key (not null).value
- Context value.public java.lang.Object getValue(java.lang.String key)
key
- Context key.null
if the key does not exist.public java.util.Set<java.lang.String> getKeys()
public java.lang.String getMessage()
public java.lang.String getLocalizedMessage()
public java.lang.String getMessage(java.util.Locale locale)
locale
- Locale in which the message should be translated.public java.lang.String getMessage(java.util.Locale locale, java.lang.String separator)
locale
- Locale in which the message should be translated.separator
- Separator inserted between the message parts.