Top Description Methods
org.slf4j.spi

public Interface MDCAdapter

Known Direct Implementers
org.slf4j.helpers.BasicMDCAdapter, org.slf4j.helpers.NOPMDCAdapter
Imports
java.util.Deque, .Map

This interface abstracts the service offered by various MDC implementations.
Author
Ceki Gülcü
Since
1.4.1

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Clear all entries in the MDC.

public void
clearDequeByKey(String
identifies the stack
key
)

Clear the deque(stack) referenced by 'key'.

public String

Returns:

the string value identified by the key parameter.
get
(String key)

Get the context identified by the key parameter.

public Map<String, String>

Returns:

A copy of the current thread's context map. May be null.
getCopyOfContextMap
()

Return a copy of the current thread's context map, with keys and values of type String.

public Deque<String>

Returns:

copy of stack referenced by 'key'. May be null.
getCopyOfDequeByKey
(String
identifies the stack
key
)

Returns a copy of the deque(stack) referenced by 'key'.

public String

Returns:

the value just popped. May be null/
popByKey
(String
identifies the deque(stack)
key
)

Pop the stack referenced by 'key' and return the value possibly null.

public void
pushByKey(String
identifies the appropriate stack
key
,
String
the value to push into the stack
value
)

Push a value into the deque(stack) referenced by 'key'.

public void
put(String key, String val)

Put a context value (the val parameter) as identified with the key parameter into the current thread's context map.

public void
remove(String key)

Remove the context identified by the key parameter.

public void
setContextMap(Map<String, String>
must contain only keys and values of type String
contextMap
)

Set the current thread's context map by first clearing any existing map and then copying the map passed as parameter.

Method Detail

clearback to summary
public void clear()

Clear all entries in the MDC.

clearDequeByKeyback to summary
public void clearDequeByKey(String key)

Clear the deque(stack) referenced by 'key'.

Parameters
key:String

identifies the stack

Since
2.0.0
getback to summary
public String get(String key)

Get the context identified by the key parameter. The key parameter cannot be null.

Returns:String

the string value identified by the key parameter.

getCopyOfContextMapback to summary
public Map<String, String> getCopyOfContextMap()

Return a copy of the current thread's context map, with keys and values of type String. Returned value may be null.

Returns:Map<String, String>

A copy of the current thread's context map. May be null.

Since
1.5.1
getCopyOfDequeByKeyback to summary
public Deque<String> getCopyOfDequeByKey(String key)

Returns a copy of the deque(stack) referenced by 'key'. May be null.

Parameters
key:String

identifies the stack

Returns:Deque<String>

copy of stack referenced by 'key'. May be null.

Since
2.0.0
popByKeyback to summary
public String popByKey(String key)

Pop the stack referenced by 'key' and return the value possibly null.

Parameters
key:String

identifies the deque(stack)

Returns:String

the value just popped. May be null/

Since
2.0.0
pushByKeyback to summary
public void pushByKey(String key, String value)

Push a value into the deque(stack) referenced by 'key'.

Parameters
key:String

identifies the appropriate stack

value:String

the value to push into the stack

Since
2.0.0
putback to summary
public void put(String key, String val)

Put a context value (the val parameter) as identified with the key parameter into the current thread's context map. The key parameter cannot be null. The val parameter can be null only if the underlying implementation supports it.

If the current thread does not have a context map it is created as a side effect of this call.

removeback to summary
public void remove(String key)

Remove the context identified by the key parameter. The key parameter cannot be null.

This method does nothing if there is no previous value associated with key.

setContextMapback to summary
public void setContextMap(Map<String, String> contextMap)

Set the current thread's context map by first clearing any existing map and then copying the map passed as parameter. The context map parameter must only contain keys and values of type String. Implementations must support null valued map passed as parameter.

Parameters
contextMap:Map<String, String>

must contain only keys and values of type String

Since
1.5.1