public class Context extends 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 need be passed to the pipeline.
|
| Constructor and Description |
|---|
Context(Object key,
Object value)
Constructs a new
Context object. |
public static final Context NONE
public Context(Object key, Object value)
Context object.key - the keyvalue - the valueIllegalArgumentException - If key is null.public Context addData(Object key, Object value)
Context object with the specified key-value pair to
the existing Context chain.key - the keyvalue - the valueContext object containing the specified pair added to the set of pairsIllegalArgumentException - If key is null.public Optional<Object> getData(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 forIllegalArgumentException - If key is null.Copyright © 2019 Microsoft Corporation. All rights reserved.