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