|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ExceptionContext
Allows the storage and retrieval of contextual information based on label-value pairs for exceptions.
Implementations are expected to manage the pairs in a list-style collection that keeps the pairs in the sequence of their addition.
ContextedException
,
ContextedRuntimeException
Method Summary | |
---|---|
ExceptionContext |
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)
Gets the contextualized error message based on a base message. |
ExceptionContext |
setContextValue(String label,
Object value)
Sets a contextual label-value pair into this context. |
Method Detail |
---|
ExceptionContext addContextValue(String label, Object value)
The pair will be added to the context, independently of an already existing pair with the same label.
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
ExceptionContext 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.
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
List<Object> getContextValues(String label)
label
- the label to get the contextual values for, may be null
null
Object getFirstContextValue(String label)
label
- the label to get the contextual value for, may be null
null
Set<String> getContextLabels()
null
List<Pair<String,Object>> getContextEntries()
null
String getFormattedExceptionMessage(String baseMessage)
baseMessage
- the base exception message without context information appended
null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |