public class DefaultExceptionContext extends java.lang.Object implements ExceptionContext, java.io.Serializable
This implementation is serializable, however this is dependent on the values that are added also being serializable.
ContextedException
,
ContextedRuntimeException
,
Serialized FormConstructor and Description |
---|
DefaultExceptionContext() |
Modifier and Type | Method and Description |
---|---|
DefaultExceptionContext |
addContextValue(java.lang.String label,
java.lang.Object value)
Adds a contextual label-value pair into this context.
|
java.util.List<Pair<java.lang.String,java.lang.Object>> |
getContextEntries()
Retrieves the full list of label-value pairs defined in the contextual data.
|
java.util.Set<java.lang.String> |
getContextLabels()
Retrieves the full set of labels defined in the contextual data.
|
java.util.List<java.lang.Object> |
getContextValues(java.lang.String label)
Retrieves all the contextual data values associated with the label.
|
java.lang.Object |
getFirstContextValue(java.lang.String label)
Retrieves the first available contextual data value associated with the label.
|
java.lang.String |
getFormattedExceptionMessage(java.lang.String baseMessage)
Builds the message containing the contextual information.
|
DefaultExceptionContext |
setContextValue(java.lang.String label,
java.lang.Object value)
Sets a contextual label-value pair into this context.
|
public DefaultExceptionContext addContextValue(java.lang.String label, java.lang.Object value)
The pair will be added to the context, independently of an already existing pair with the same label.
addContextValue
in interface ExceptionContext
label
- the label of the item to add, null
not recommendedvalue
- the value of item to add, may be null
this
, for method chaining, not null
public DefaultExceptionContext setContextValue(java.lang.String label, java.lang.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 ExceptionContext
label
- the label of the item to add, null
not recommendedvalue
- the value of item to add, may be null
this
, for method chaining, not null
public java.util.List<java.lang.Object> getContextValues(java.lang.String label)
getContextValues
in interface ExceptionContext
label
- the label to get the contextual values for, may be null
null
public java.lang.Object getFirstContextValue(java.lang.String label)
getFirstContextValue
in interface ExceptionContext
label
- the label to get the contextual value for, may be null
null
public java.util.Set<java.lang.String> getContextLabels()
getContextLabels
in interface ExceptionContext
null
public java.util.List<Pair<java.lang.String,java.lang.Object>> getContextEntries()
getContextEntries
in interface ExceptionContext
null
public java.lang.String getFormattedExceptionMessage(java.lang.String baseMessage)
getFormattedExceptionMessage
in interface ExceptionContext
baseMessage
- the base exception message without context information appended"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"