|
|||||||||
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 java.util.Map<java.lang.String,java.lang.Object> |
context
Arbitrary context information. |
private java.util.List<java.lang.Object[]> |
msgArguments
Various informations that enrich the informative message. |
private java.util.List<Localizable> |
msgPatterns
Various informations that enrich the informative message. |
private static long |
serialVersionUID
Serializable version Id. |
private java.lang.Throwable |
throwable
The throwable to which this context refers to. |
Constructor Summary | |
---|---|
ExceptionContext(java.lang.Throwable throwable)
Simple constructor. |
Method Summary | |
---|---|
void |
addMessage(Localizable pattern,
java.lang.Object... arguments)
Adds a message. |
private java.lang.String |
buildMessage(java.util.Locale locale,
java.lang.String separator)
Builds a message string. |
private void |
deSerializeContext(java.io.ObjectInputStream in)
Deserialize context . |
private void |
deSerializeMessages(java.io.ObjectInputStream in)
Deserialize msgPatterns and msgArguments . |
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. |
private java.lang.String |
nonSerializableReplacement(java.lang.Object obj)
Replaces a non-serializable object with an error message string. |
private void |
readObject(java.io.ObjectInputStream in)
Deserialize this object from the given stream. |
private void |
serializeContext(java.io.ObjectOutputStream out)
Serialize context . |
private void |
serializeMessages(java.io.ObjectOutputStream out)
Serialize msgPatterns and msgArguments . |
void |
setValue(java.lang.String key,
java.lang.Object value)
Sets the context (key, value) pair. |
private void |
writeObject(java.io.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 java.lang.Throwable throwable
private java.util.List<Localizable> msgPatterns
private java.util.List<java.lang.Object[]> msgArguments
msgPatterns
.
private java.util.Map<java.lang.String,java.lang.Object> context
Constructor Detail |
---|
public ExceptionContext(java.lang.Throwable throwable)
throwable
- the exception this context refers tooMethod Detail |
---|
public 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.
private java.lang.String buildMessage(java.util.Locale locale, java.lang.String separator)
locale
- Locale in which the message should be translated.separator
- Message separator.
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
out
- Stream.
java.io.IOException
- This should never happen.private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- Stream.
java.io.IOException
- This should never happen.
java.lang.ClassNotFoundException
- This should never happen.private void serializeMessages(java.io.ObjectOutputStream out) throws java.io.IOException
msgPatterns
and msgArguments
.
out
- Stream.
java.io.IOException
- This should never happen.private void deSerializeMessages(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
msgPatterns
and msgArguments
.
in
- Stream.
java.io.IOException
- This should never happen.
java.lang.ClassNotFoundException
- This should never happen.private void serializeContext(java.io.ObjectOutputStream out) throws java.io.IOException
context
.
out
- Stream.
java.io.IOException
- This should never happen.private void deSerializeContext(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
context
.
in
- Stream.
java.io.IOException
- This should never happen.
java.lang.ClassNotFoundException
- This should never happen.private java.lang.String nonSerializableReplacement(java.lang.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 |