public class Context
extends java.lang.Object
Context offers a means of passing arbitrary data (key-value pairs) to pipeline policies.
Most applications do not need to pass arbitrary data to the pipeline and can pass Context.NONE or
null.
Each context object is immutable. The addData(Object, Object) method creates a new
Context object that refers to its parent, forming a linked list.
| Modifier and Type | Field and Description |
|---|---|
static Context |
NONE
Signifies that no data needs to be passed to the pipeline.
|
| Constructor and Description |
|---|
Context(java.lang.Object key,
java.lang.Object value)
Constructs a new
Context object. |
| Modifier and Type | Method and Description |
|---|---|
Context |
addData(java.lang.Object key,
java.lang.Object value)
|
Option<java.lang.Object> |
getData(java.lang.Object key)
Scans the linked-list of
Context objects looking for one with the specified key. |
public static final Context NONE
public Context(java.lang.Object key,
java.lang.Object value)
Context object.key - The key with which the specified value should be associated.value - The value to be associated with the specified key.java.lang.IllegalArgumentException - If key is null.public Context addData(java.lang.Object key, java.lang.Object value)
Context object with the specified key-value pair to
the existing Context chain.key - The key with which the specified value should be associated.value - The value to be associated with the specified key.Context object containing the specified pair added to the set of pairs.java.lang.IllegalArgumentException - If key is null.public Option<java.lang.Object> getData(java.lang.Object key)
Context objects looking for one with the specified key.
Note that the first key found, i.e. the most recently added, will be returned.key - The key to search for.java.lang.IllegalArgumentException - If key is null.