|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.commons.math3.exception.util.ExceptionContext
public class ExceptionContext
Class that contains the actual implementation of the functionality mandated
by the ExceptionContext interface.
All Commons Math exceptions delegate the interface's methods to this class.
| Field Summary | |
|---|---|
private Map<String,Object> |
context
Arbitrary context information. |
private List<Object[]> |
msgArguments
Various informations that enrich the informative message. |
private List<Localizable> |
msgPatterns
Various informations that enrich the informative message. |
private static long |
serialVersionUID
Serializable version Id. |
private Throwable |
throwable
The throwable to which this context refers to. |
| Constructor Summary | |
|---|---|
ExceptionContext(Throwable throwable)
Simple constructor. |
|
| Method Summary | |
|---|---|
void |
addMessage(Localizable pattern,
Object... arguments)
Adds a message. |
private String |
buildMessage(Locale locale,
String separator)
Builds a message string. |
private void |
deSerializeContext(ObjectInputStream in)
Deserialize context. |
private void |
deSerializeMessages(ObjectInputStream in)
Deserialize msgPatterns and msgArguments. |
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. |
private String |
nonSerializableReplacement(Object obj)
Replaces a non-serializable object with an error message string. |
private void |
readObject(ObjectInputStream in)
Deserialize this object from the given stream. |
private void |
serializeContext(ObjectOutputStream out)
Serialize context. |
private void |
serializeMessages(ObjectOutputStream out)
Serialize msgPatterns and msgArguments. |
void |
setValue(String key,
Object value)
Sets the context (key, value) pair. |
private void |
writeObject(ObjectOutputStream out)
Serialize this object to the given stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private Throwable throwable
private List<Localizable> msgPatterns
private List<Object[]> msgArguments
msgPatterns.
private Map<String,Object> context
| Constructor Detail |
|---|
public ExceptionContext(Throwable throwable)
throwable - the exception this context refers too| Method Detail |
|---|
public 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.
private String buildMessage(Locale locale,
String separator)
locale - Locale in which the message should be translated.separator - Message separator.
private void writeObject(ObjectOutputStream out)
throws IOException
out - Stream.
IOException - This should never happen.
private void readObject(ObjectInputStream in)
throws IOException,
ClassNotFoundException
in - Stream.
IOException - This should never happen.
ClassNotFoundException - This should never happen.
private void serializeMessages(ObjectOutputStream out)
throws IOException
msgPatterns and msgArguments.
out - Stream.
IOException - This should never happen.
private void deSerializeMessages(ObjectInputStream in)
throws IOException,
ClassNotFoundException
msgPatterns and msgArguments.
in - Stream.
IOException - This should never happen.
ClassNotFoundException - This should never happen.
private void serializeContext(ObjectOutputStream out)
throws IOException
context.
out - Stream.
IOException - This should never happen.
private void deSerializeContext(ObjectInputStream in)
throws IOException,
ClassNotFoundException
context.
in - Stream.
IOException - This should never happen.
ClassNotFoundException - This should never happen.private String nonSerializableReplacement(Object obj)
obj - Object that does not implement the Serializable
interface.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||