public class ConnectContext extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
JSON_PREFIX |
static NamedConnectContext |
requestId |
static NamedConnectContext |
scenarioId |
| Constructor and Description |
|---|
ConnectContext() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clear()
Clear the logging context (usually this thread)
|
static String |
get(String key)
Gets a key and returns the string representation of it.
|
static <T> T |
get(String key,
Class<T> clazz)
Takes the given key, finds the json: prefix version of it.
|
static Map<String,String> |
getContext()
The complete context.
|
static void |
remove(String key)
Remove the specific key.
|
static void |
set(String key,
Object value)
logging contexts can generally only deal with strings
|
static void |
setContext(Map<String,String> pushContext)
used when transferring context between threads
|
public static NamedConnectContext requestId
public static NamedConnectContext scenarioId
public static final String JSON_PREFIX
public static void clear()
public static void remove(String key)
key - - key to remove from contextpublic static void set(String key, Object value)
key - - the key to use, will be replaced with json.KEY if value is object. If the value is a JSON
object that needs to be preserved as a JSON object, use the JSON_PREFIX in your key.value - - java.lang variants are stored as strings, other objects are converted to JSONpublic static String get(String key)
key - - key and will try and find the json version of it if missing.*public static <T> T get(String key, Class<T> clazz)
T - - the typekey - - the key to get (minus the json prefix)clazz - - the class to serialize intoCopyright © 2017. All rights reserved.