public class DefaultExceptionContext extends Object implements ExceptionContext, Serializable
This implementation is serializable, however this is dependent on the values that are added also being serializable.
ContextedException,
ContextedRuntimeException,
Serialized Form| Constructor and Description |
|---|
DefaultExceptionContext() |
| Modifier and Type | Method and Description |
|---|---|
DefaultExceptionContext |
addContextValue(String label,
Object value)
Adds a contextual label-value pair into this context.
|
List<Pair<String,Object>> |
getContextEntries()
Retrieves the full list of label-value pairs defined in the contextual data.
|
Set<String> |
getContextLabels()
Retrieves the full set of labels defined in the contextual data.
|
List<Object> |
getContextValues(String label)
Retrieves all the contextual data values associated with the label.
|
Object |
getFirstContextValue(String label)
Retrieves the first available contextual data value associated with the label.
|
String |
getFormattedExceptionMessage(String baseMessage)
Builds the message containing the contextual information.
|
DefaultExceptionContext |
setContextValue(String label,
Object value)
Sets a contextual label-value pair into this context.
|
public DefaultExceptionContext addContextValue(String label, Object value)
The pair will be added to the context, independently of an already existing pair with the same label.
addContextValue in interface ExceptionContextlabel - the label of the item to add, null not recommendedvalue - the value of item to add, may be nullthis, for method chaining, not nullpublic DefaultExceptionContext setContextValue(String label, Object value)
The pair will be added normally, but any existing label-value pair with the same label is removed from the context.
setContextValue in interface ExceptionContextlabel - the label of the item to add, null not recommendedvalue - the value of item to add, may be nullthis, for method chaining, not nullpublic List<Object> getContextValues(String label)
getContextValues in interface ExceptionContextlabel - the label to get the contextual values for, may be nullnullpublic Object getFirstContextValue(String label)
getFirstContextValue in interface ExceptionContextlabel - the label to get the contextual value for, may be nullnullpublic Set<String> getContextLabels()
getContextLabels in interface ExceptionContextnullpublic List<Pair<String,Object>> getContextEntries()
getContextEntries in interface ExceptionContextnullpublic String getFormattedExceptionMessage(String baseMessage)
getFormattedExceptionMessage in interface ExceptionContextbaseMessage - the base exception message without context information appendedCopyright © 2021 Internet2. All rights reserved.