Implementations are expected to manage the pairs in a list-style collection that keeps the pairs in the sequence of their addition.
ContextedException, ContextedRuntimeException
| Modifier and Type | Method and Description |
|---|---|
| public ExceptionContext | Returns: this, for method chaining, not nullthe label of the item to add, label, Object null not recommendedthe value of item to add, may be value)nullAdds a contextual label-value pair into this context. |
| public List | Returns: the list of pairs, notnullGets the full list of label-value pairs defined in the contextual data. |
| public Set | Returns: the set of labels, notnullGets the full set of labels defined in the contextual data. |
| public List | Returns: the contextual values associated with the label, nevernullthe label to get the contextual values for, may be label)nullGets all the contextual data values associated with the label. |
| public Object | Returns: the first contextual value associated with the label, may benullthe label to get the contextual value for, may be label)nullGets the first available contextual data value associated with the label. |
| public String | Returns: the exception message with context information appended, notnullthe base exception message without context information appended baseMessage)Gets the contextualized error message based on a base message. |
| public ExceptionContext | Returns: this, for method chaining, not nullthe label of the item to add, label, Object null not recommendedthe value of item to add, may be value)nullSets a contextual label-value pair into this context. |
| addContextValue | back to summary |
|---|---|
| public ExceptionContext addContextValue(String label, Object value) Adds a contextual label-value pair into this context. The pair will be added to the context, independently of an already existing pair with the same label.
| |
| getContextEntries | back to summary |
|---|---|
| public List Gets the full list of label-value pairs defined in the contextual data. | |
| getContextLabels | back to summary |
|---|---|
| public Set Gets the full set of labels defined in the contextual data. | |
| getContextValues | back to summary |
|---|---|
| public List Gets all the contextual data values associated with the label. | |
| getFirstContextValue | back to summary |
|---|---|
| public Object getFirstContextValue(String label) Gets the first available contextual data value associated with the label. | |
| getFormattedExceptionMessage | back to summary |
|---|---|
| public String getFormattedExceptionMessage(String baseMessage) Gets the contextualized error message based on a base message. This will add the context label-value pairs to the message. | |
| setContextValue | back to summary |
|---|---|
| public ExceptionContext setContextValue(String label, Object value) Sets a contextual label-value pair into this context. The pair will be added normally, but any existing label-value pair with the same label is removed from the context.
| |