Package growthbook.sdk.java.evaluators
Class ConditionEvaluator
java.lang.Object
growthbook.sdk.java.evaluators.ConditionEvaluator
INTERNAL: Implementation of condition evaluation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionevaluateCondition
(com.google.gson.JsonObject attributes, com.google.gson.JsonObject conditionJson, com.google.gson.JsonObject savedGroups) Evaluate a condition for a set of user attributes based on the provided condition.Given attributes and a dot-separated path string,isOperatorObject
(com.google.gson.JsonElement object) This accepts a parsed JSON object as input and returns true if every key in the object starts with $.
-
Constructor Details
-
ConditionEvaluator
public ConditionEvaluator()
-
-
Method Details
-
evaluateCondition
public Boolean evaluateCondition(com.google.gson.JsonObject attributes, com.google.gson.JsonObject conditionJson, @Nullable com.google.gson.JsonObject savedGroups) Evaluate a condition for a set of user attributes based on the provided condition. The condition syntax closely resembles MongoDB's syntax. This is defined in the Feature's targeting conditions' Advanced settings.- Parameters:
attributes
- A JsonObject of the user attributes to evaluateconditionJson
- A JsonObject of the condition- Returns:
- Whether the condition should be true for the user
-
isOperatorObject
This accepts a parsed JSON object as input and returns true if every key in the object starts with $.- Parameters:
object
- The object to evaluate- Returns:
- if all keys start with $
-
getPath
Given attributes and a dot-separated path string,- Parameters:
attributes
- User attributespath
- String path, e.g. path.to.something- Returns:
- the value at that path (or null if the path doesn't exist)
-