|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.log.ContextMap
public final class ContextMap
The ContextMap contains non-hierarchical context information relevant to a particular LogEvent. It may include information such as;
Field Summary | |
---|---|
private static java.lang.ThreadLocal |
c_localContext
|
private java.util.Hashtable |
m_map
|
private ContextMap |
m_parent
|
private boolean |
m_readOnly
|
Constructor Summary | |
---|---|
ContextMap()
Default constructor. |
|
ContextMap(ContextMap parent)
Constructor that sets parent contextMap. |
Method Summary | |
---|---|
static void |
bind(ContextMap context)
Bind a particular ContextMap to current thread. |
private void |
checkReadable()
Utility method to verify that Context is read-only. |
void |
clear()
Empty the context map. |
java.lang.Object |
get(java.lang.String key)
Get an entry from the context. |
java.lang.Object |
get(java.lang.String key,
java.lang.Object defaultObject)
Get an entry from the context. |
static ContextMap |
getCurrentContext()
Get the Current ContextMap. |
static ContextMap |
getCurrentContext(boolean autocreate)
Get the Current ContextMap. |
int |
getSize()
Get the number of contexts in map. |
boolean |
isReadOnly()
Determine if context is read-only. |
void |
makeReadOnly()
Make the context read-only. |
private java.lang.Object |
readResolve()
Helper method that sets context to read-only after de-serialization. |
void |
set(java.lang.String key,
java.lang.Object value)
Set a value in context |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.ThreadLocal c_localContext
private final ContextMap m_parent
private java.util.Hashtable m_map
private transient boolean m_readOnly
Constructor Detail |
---|
public ContextMap()
public ContextMap(ContextMap parent)
parent
- the parent ContextMapMethod Detail |
---|
public static final ContextMap getCurrentContext()
public static final ContextMap getCurrentContext(boolean autocreate)
autocreate
- true if a ContextMap is to be created if it doesn't exist
public static final void bind(ContextMap context)
context
- the context map (may be null)public void makeReadOnly()
public boolean isReadOnly()
public void clear()
public java.lang.Object get(java.lang.String key, java.lang.Object defaultObject)
key
- the key to mapdefaultObject
- a default object to return if key does not exist
public java.lang.Object get(java.lang.String key)
key
- the key to map
public void set(java.lang.String key, java.lang.Object value)
key
- the keyvalue
- the value (may be null)public int getSize()
private java.lang.Object readResolve()
private void checkReadable()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |