1   package org.slf4j.spi;
2   
3   /**
4    * This interface abstracts the service offered by various MDC
5    * implementations.
6    * 
7    * @author Ceki Gülcü
8    * @since 1.4.1
9    */
10  public interface MDCAdapter {
11  
12    /**
13     * Put a context value (the <code>val</code> parameter) as identified with
14     * the <code>key</code> parameter into the current thread's context map. 
15     * The <code>key</code> parameter cannot be null. The code>val</code> parameter 
16     * can be null only if the underlying implementation supports it.
17     * 
18     * <p>If the current thread does not have a context map it is created as a side
19     * effect of this call.
20     */
21    public void put(String key, String val);
22  
23    /**
24     * Get the context identified by the <code>key</code> parameter.
25     * The <code>key</code> parameter cannot be null.
26     * 
27     * @return the string value identified by the <code>key</code> parameter.
28     */
29    public String get(String key);
30  
31    /**
32     * Remove the the context identified by the <code>key</code> parameter. 
33     * The <code>key</code> parameter cannot be null. 
34     * 
35     * <p>
36     * This method does nothing if there is no previous value 
37     * associated with <code>key</code>.
38     */
39    public void remove(String key);
40  
41    /**
42     * Clear all entries in the MDC.
43     */
44    public void clear();
45  
46  }