public class MDCContextMap extends java.lang.Object implements CleanableThreadContextMap
Modifier and Type | Field and Description |
---|---|
private static StringMap |
EMPTY_CONTEXT_DATA |
Constructor and Description |
---|
MDCContextMap() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the context.
|
boolean |
containsKey(java.lang.String key)
Determines if the key is in the context.
|
java.lang.String |
get(java.lang.String key)
Gets the context identified by the
key parameter. |
java.util.Map<java.lang.String,java.lang.String> |
getCopy()
Gets a non-
null mutable copy of current thread's context Map. |
java.util.Map<java.lang.String,java.lang.String> |
getImmutableMapOrNull()
Returns an immutable view on the context Map or
null if the context map is empty. |
StringMap |
getReadOnlyContextData()
Returns the context data for reading.
|
boolean |
isEmpty()
Returns true if the Map is empty.
|
void |
put(java.lang.String key,
java.lang.String value)
Puts a context value (the
o parameter) as identified
with the key parameter into the current thread's
context map. |
void |
putAll(java.util.Map<java.lang.String,java.lang.String> m)
Puts all given context map entries into the current thread's
context map.
|
void |
remove(java.lang.String key)
Removes the the context identified by the
key
parameter. |
void |
removeAll(java.lang.Iterable<java.lang.String> keys)
Removes all given context map keys from the current thread's context map.
|
private static final StringMap EMPTY_CONTEXT_DATA
public void put(java.lang.String key, java.lang.String value)
ThreadContextMap
o
parameter) as identified
with the key
parameter into the current thread's
context map.
If the current thread does not have a context map it is created as a side effect.
put
in interface ThreadContextMap
key
- The key name.value
- The key value.public void putAll(java.util.Map<java.lang.String,java.lang.String> m)
ThreadContextMap2
If the current thread does not have a context map it is created as a side effect.
putAll
in interface ThreadContextMap2
m
- The map.public java.lang.String get(java.lang.String key)
ThreadContextMap
key
parameter.
This method has no side effects.
get
in interface ThreadContextMap
key
- The key to locate.public void remove(java.lang.String key)
ThreadContextMap
key
parameter.remove
in interface ThreadContextMap
key
- The key to remove.public void removeAll(java.lang.Iterable<java.lang.String> keys)
CleanableThreadContextMap
If the current thread does not have a context map it is created as a side effect.
removeAll
in interface CleanableThreadContextMap
keys
- The keys.public void clear()
ThreadContextMap
clear
in interface ThreadContextMap
public boolean containsKey(java.lang.String key)
ThreadContextMap
containsKey
in interface ThreadContextMap
key
- The key to locate.public java.util.Map<java.lang.String,java.lang.String> getCopy()
ThreadContextMap
null
mutable copy of current thread's context Map.getCopy
in interface ThreadContextMap
public java.util.Map<java.lang.String,java.lang.String> getImmutableMapOrNull()
ThreadContextMap
null
if the context map is empty.getImmutableMapOrNull
in interface ThreadContextMap
null
.public boolean isEmpty()
ThreadContextMap
isEmpty
in interface ThreadContextMap
public StringMap getReadOnlyContextData()
ThreadContextMap2
getReadOnlyContextData
in interface ThreadContextMap2
StringMap