java.lang.Object
dev.openfeature.sdk.MutableContext
- All Implemented Interfaces:
EvaluationContext,Structure
The EvaluationContext is a container for arbitrary contextual data
that can be used as a basis for dynamic evaluation.
The MutableContext is an EvaluationContext implementation which is not threadsafe, and whose attributes can
be modified after instantiation.
-
Field Summary
Fields inherited from interface dev.openfeature.sdk.EvaluationContext
TARGETING_KEY -
Constructor Summary
ConstructorsConstructorDescriptionMutableContext(String targetingKey) MutableContext(String targetingKey, Map<String, Value> attributes) Create a mutable context with given targetingKey and attributes provided.MutableContext(Map<String, Value> attributes) -
Method Summary
Modifier and TypeMethodDescriptionRetrieve targetingKey from the context.merge(EvaluationContext overridingContext) Merges this EvaluationContext objects with the second overriding the in case of conflict.setTargetingKey(String targetingKey) Override or set targeting key for this mutable context.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.openfeature.sdk.Structure
asMap, asObjectMap, asUnmodifiableMap, convertValue, getValue, isEmpty, keySet
-
Constructor Details
-
MutableContext
public MutableContext() -
MutableContext
-
MutableContext
-
MutableContext
Create a mutable context with given targetingKey and attributes provided. TargetingKey should be non-null and non-empty to be accepted.- Parameters:
targetingKey- targeting keyattributes- evaluation context attributes
-
-
Method Details
-
add
-
add
-
add
-
add
-
add
-
add
-
add
-
setTargetingKey
Override or set targeting key for this mutable context. Value should be non-null and non-empty to be accepted. -
getTargetingKey
Retrieve targetingKey from the context.- Specified by:
getTargetingKeyin interfaceEvaluationContext
-
merge
Merges this EvaluationContext objects with the second overriding the in case of conflict.- Specified by:
mergein interfaceEvaluationContext- Parameters:
overridingContext- overriding context- Returns:
- resulting merged context
-