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

com.azure.ai.metricsadvisor.implementation.models.SeriesIdentity 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.Fluent;
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;

/**
 * The SeriesIdentity model.
 */
@Fluent
public final class SeriesIdentity implements JsonSerializable {
    /*
     * dimension specified for series
     */
    private Map dimension;

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

    /**
     * Get the dimension property: dimension specified for series.
     * 
     * @return the dimension value.
     */
    public Map getDimension() {
        return this.dimension;
    }

    /**
     * Set the dimension property: dimension specified for series.
     * 
     * @param dimension the dimension value to set.
     * @return the SeriesIdentity object itself.
     */
    public SeriesIdentity setDimension(Map dimension) {
        this.dimension = dimension;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeMapField("dimension", this.dimension, (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("dimension".equals(fieldName)) {
                    Map dimension = reader.readMap(reader1 -> reader1.getString());
                    deserializedSeriesIdentity.dimension = dimension;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSeriesIdentity;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy