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

com.azure.ai.metricsadvisor.implementation.models.DetectionAnomalyResultQuery 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.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

/**
 * The DetectionAnomalyResultQuery model.
 */
@Fluent
public final class DetectionAnomalyResultQuery implements JsonSerializable {
    /*
     * start time
     */
    private OffsetDateTime startTime;

    /*
     * end time
     */
    private OffsetDateTime endTime;

    /*
     * The filter property.
     */
    private DetectionAnomalyFilterCondition filter;

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

    /**
     * Get the startTime property: start time.
     * 
     * @return the startTime value.
     */
    public OffsetDateTime getStartTime() {
        return this.startTime;
    }

    /**
     * Set the startTime property: start time.
     * 
     * @param startTime the startTime value to set.
     * @return the DetectionAnomalyResultQuery object itself.
     */
    public DetectionAnomalyResultQuery setStartTime(OffsetDateTime startTime) {
        this.startTime = startTime;
        return this;
    }

    /**
     * Get the endTime property: end time.
     * 
     * @return the endTime value.
     */
    public OffsetDateTime getEndTime() {
        return this.endTime;
    }

    /**
     * Set the endTime property: end time.
     * 
     * @param endTime the endTime value to set.
     * @return the DetectionAnomalyResultQuery object itself.
     */
    public DetectionAnomalyResultQuery setEndTime(OffsetDateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    /**
     * Get the filter property: The filter property.
     * 
     * @return the filter value.
     */
    public DetectionAnomalyFilterCondition getFilter() {
        return this.filter;
    }

    /**
     * Set the filter property: The filter property.
     * 
     * @param filter the filter value to set.
     * @return the DetectionAnomalyResultQuery object itself.
     */
    public DetectionAnomalyResultQuery setFilter(DetectionAnomalyFilterCondition filter) {
        this.filter = filter;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("startTime",
            this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime));
        jsonWriter.writeStringField("endTime",
            this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime));
        jsonWriter.writeJsonField("filter", this.filter);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of DetectionAnomalyResultQuery from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of DetectionAnomalyResultQuery 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 DetectionAnomalyResultQuery.
     */
    public static DetectionAnomalyResultQuery fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            DetectionAnomalyResultQuery deserializedDetectionAnomalyResultQuery = new DetectionAnomalyResultQuery();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("startTime".equals(fieldName)) {
                    deserializedDetectionAnomalyResultQuery.startTime
                        = reader.getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString()));
                } else if ("endTime".equals(fieldName)) {
                    deserializedDetectionAnomalyResultQuery.endTime
                        = reader.getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString()));
                } else if ("filter".equals(fieldName)) {
                    deserializedDetectionAnomalyResultQuery.filter = DetectionAnomalyFilterCondition.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDetectionAnomalyResultQuery;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy