All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.statsig.Experiment Maven / Gradle / Ivy

The newest version!
package com.statsig;

import java.util.Map;

import com.google.gson.JsonElement;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.statsig.internal.GsonUtil;

public class Experiment {
    public final String name;
    @SerializedName("rule_id")
    public final String ruleID;
    @SerializedName("value")
    public final Map value;
    @SerializedName("group_name")
    public final String groupName;
    @SerializedName("details")
    public final EvaluationDetails evaluationDetails;
    @Expose(serialize = false, deserialize = false)
    String rawJson;

    Experiment(String name, Map value, String ruleID, String groupName,
                      EvaluationDetails evaluationDetails) {
        this.name = name;
        this.value = value;
        this.ruleID = ruleID;
        this.groupName = groupName;
        this.evaluationDetails = evaluationDetails;
    }

    public String getName() {
        return name;
    }

    public String getRuleID() {
        return ruleID;
    }

    public Map getValue() {
        return value;
    }

    public String getGroupName() {
        return groupName;
    }

    public EvaluationDetails getEvaluationDetails() {
        return evaluationDetails;
    }

    public String getRawJson() {
        return rawJson;
    }

    void setRawJson(String rawJson) {
        this.rawJson = rawJson;
    }

    public String getString(String key, String defaultValue) {
        return GsonUtil.getString(value, key, defaultValue);
    }

    public boolean getBoolean(String key, boolean defaultValue) {
        return GsonUtil.getBoolean(value, key, defaultValue);
    }

    public double getDouble(String key, double defaultValue) {
        return GsonUtil.getDouble(value, key, defaultValue);
    }

    public int getInt(String key, int defaultValue) {
        return GsonUtil.getInt(value, key, defaultValue);
    }

    public long getLong(String key, long defaultValue) {
        return GsonUtil.getLong(value, key, defaultValue);
    }

    public Object[] getArray(String key, Object[] defaultValue) {
        return GsonUtil.getArray(value, key, defaultValue);
    }

    public Map getMap(String key, Map defaultValue) {
        return GsonUtil.getMap(value, key, defaultValue);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy