Class ExceptionContext
java.lang.Object
org.apache.commons.math3.exception.util.ExceptionContext
- All Implemented Interfaces:
Serializable
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.- Since:
- 3.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionArbitrary context information.Various informations that enrich the informative message.private List<Localizable> Various informations that enrich the informative message.private static final longSerializable version Id.private ThrowableThe throwable to which this context refers to. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(Localizable pattern, Object... arguments) Adds a message.private StringbuildMessage(Locale locale, String separator) Builds a message string.private voidDeserializecontext.private voidDeserializemsgPatternsandmsgArguments.getKeys()Gets all the keys stored in the exceptionGets the message in the default locale.Gets the default message.getMessage(Locale locale) Gets the message in a specified locale.getMessage(Locale locale, String separator) Gets the message in a specified locale.Get a reference to the exception to which the context relates.Gets the value associated to the given context key.private StringReplaces a non-serializable object with an error message string.private voidDeserialize this object from the given stream.private voidSerializecontext.private voidSerializemsgPatternsandmsgArguments.voidSets the context (key, value) pair.private voidSerialize this object to the given stream.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerializable version Id.- See Also:
-
throwable
The throwable to which this context refers to. -
msgPatterns
Various informations that enrich the informative message. -
msgArguments
Various informations that enrich the informative message. The arguments will replace the corresponding place-holders inmsgPatterns. -
context
-
-
Constructor Details
-
ExceptionContext
Simple constructor.- Parameters:
throwable- the exception this context refers too
-
-
Method Details
-
getThrowable
Get a reference to the exception to which the context relates.- Returns:
- a reference to the exception to which the context relates
-
addMessage
Adds a message.- Parameters:
pattern- Message pattern.arguments- Values for replacing the placeholders in the message pattern.
-
setValue
-
getValue
-
getKeys
-
getMessage
-
getLocalizedMessage
Gets the message in the default locale.- Returns:
- the localized message.
-
getMessage
-
getMessage
-
buildMessage
-
writeObject
Serialize this object to the given stream.- Parameters:
out- Stream.- Throws:
IOException- This should never happen.
-
readObject
Deserialize this object from the given stream.- Parameters:
in- Stream.- Throws:
IOException- This should never happen.ClassNotFoundException- This should never happen.
-
serializeMessages
SerializemsgPatternsandmsgArguments.- Parameters:
out- Stream.- Throws:
IOException- This should never happen.
-
deSerializeMessages
DeserializemsgPatternsandmsgArguments.- Parameters:
in- Stream.- Throws:
IOException- This should never happen.ClassNotFoundException- This should never happen.
-
serializeContext
Serializecontext.- Parameters:
out- Stream.- Throws:
IOException- This should never happen.
-
deSerializeContext
Deserializecontext.- Parameters:
in- Stream.- Throws:
IOException- This should never happen.ClassNotFoundException- This should never happen.
-
nonSerializableReplacement
-