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

com.azure.ai.metricsadvisor.implementation.models.MetricSeriesItem Maven / Gradle / Ivy

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.ai.metricsadvisor.implementation.models;

import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.Map;
import java.util.UUID;

/**
 * The MetricSeriesItem model.
 */
@Immutable
public final class MetricSeriesItem implements JsonSerializable {
    /*
     * metric unique id
     */
    private UUID metricId;

    /*
     * dimension name and value pair
     */
    private Map dimension;

    /**
     * Creates an instance of MetricSeriesItem class.
     */
    public MetricSeriesItem() {
    }

    /**
     * Get the metricId property: metric unique id.
     * 
     * @return the metricId value.
     */
    public UUID getMetricId() {
        return this.metricId;
    }

    /**
     * Get the dimension property: dimension name and value pair.
     * 
     * @return the dimension value.
     */
    public Map getDimension() {
        return this.dimension;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of MetricSeriesItem from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of MetricSeriesItem if the JsonReader was pointing to an instance of it, or null if it was
     * pointing to JSON null.
     * @throws IOException If an error occurs while reading the MetricSeriesItem.
     */
    public static MetricSeriesItem fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            MetricSeriesItem deserializedMetricSeriesItem = new MetricSeriesItem();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("metricId".equals(fieldName)) {
                    deserializedMetricSeriesItem.metricId
                        = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
                } else if ("dimension".equals(fieldName)) {
                    Map dimension = reader.readMap(reader1 -> reader1.getString());
                    deserializedMetricSeriesItem.dimension = dimension;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMetricSeriesItem;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy