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

com.aliyun.openservices.log.response.ListMetricsConfigResponse Maven / Gradle / Ivy

There is a newer version: 0.6.115
Show newest version
package com.aliyun.openservices.log.response;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.aliyun.openservices.log.common.MetricsConfig;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class ListMetricsConfigResponse extends Response {

    private List metricsConfigList;

    public ListMetricsConfigResponse(Map headers) {
        super(headers);
    }

    public ListMetricsConfigResponse(Map headers, List metricsConfigList) {
        super(headers);
        this.metricsConfigList = metricsConfigList;
    }

    public void fromJSON(JSONObject object) {
        metricsConfigList = new ArrayList();
        if (object == null) {
            return;
        }
        JSONArray array = object.getJSONArray("metricsConfig");
        for (int i = 0; i < array.size(); i++) {
            JSONObject jsonObject = array.getJSONObject(i);
            if (jsonObject == null) {
                continue;
            }
            String metricStore = jsonObject.getString("metricStore");
            MetricsConfig metricsConfig = JSONObject.parseObject(jsonObject.getString("metricsConfigDetail"), MetricsConfig.class);
            MetricsConfigWrap metricsConfigWrap = new MetricsConfigWrap(metricStore, metricsConfig);
            metricsConfigList.add(metricsConfigWrap);
        }
    }

    public List getMetricsConfigList() {
        return metricsConfigList;
    }

    public void setMetricsConfigList(List metricsConfigs) {
        this.metricsConfigList = metricsConfigs;
    }

    public static class MetricsConfigWrap {
        @JSONField
        private String metricStore;
        @JSONField
        private MetricsConfig metricsConfigDetail;

        public MetricsConfigWrap(String metricStore, MetricsConfig metricsConfig) {
            this.metricStore = metricStore;
            this.metricsConfigDetail = metricsConfig;
        }

        public String getMetricStore() {
            return metricStore;
        }

        public void setMetricStore(String metricStore) {
            this.metricStore = metricStore;
        }

        public MetricsConfig getMetricsConfig() {
            return metricsConfigDetail;
        }

        public void setMetricsConfig(MetricsConfig metricsConfig) {
            this.metricsConfigDetail = metricsConfig;
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy