use of com.optimizely.ab.config.LiveVariable.VariableStatus in project java-sdk by optimizely.
the class JsonSimpleConfigParser method parseLiveVariables.
private List<LiveVariable> parseLiveVariables(JSONArray liveVariablesJson) {
List<LiveVariable> liveVariables = new ArrayList<LiveVariable>(liveVariablesJson.size());
for (Object obj : liveVariablesJson) {
JSONObject liveVariableObject = (JSONObject) obj;
String id = (String) liveVariableObject.get("id");
String key = (String) liveVariableObject.get("key");
String defaultValue = (String) liveVariableObject.get("defaultValue");
VariableType type = VariableType.fromString((String) liveVariableObject.get("type"));
VariableStatus status = VariableStatus.fromString((String) liveVariableObject.get("status"));
liveVariables.add(new LiveVariable(id, key, defaultValue, status, type));
}
return liveVariables;
}
use of com.optimizely.ab.config.LiveVariable.VariableStatus in project java-sdk by optimizely.
the class JsonConfigParser method parseLiveVariables.
private List<LiveVariable> parseLiveVariables(JSONArray liveVariablesJson) {
List<LiveVariable> liveVariables = new ArrayList<LiveVariable>(liveVariablesJson.length());
for (Object obj : liveVariablesJson) {
JSONObject liveVariableObject = (JSONObject) obj;
String id = liveVariableObject.getString("id");
String key = liveVariableObject.getString("key");
String defaultValue = liveVariableObject.getString("defaultValue");
VariableType type = VariableType.fromString(liveVariableObject.getString("type"));
VariableStatus status = null;
if (liveVariableObject.has("status")) {
status = VariableStatus.fromString(liveVariableObject.getString("status"));
}
liveVariables.add(new LiveVariable(id, key, defaultValue, status, type));
}
return liveVariables;
}
Aggregations