com.azure.ai.metricsadvisor.implementation.models.AnomalyProperty Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-ai-metricsadvisor Show documentation
Show all versions of azure-ai-metricsadvisor Show documentation
This package contains the Microsoft Azure Cognitive Services Metrics Advisor SDK.
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.ai.metricsadvisor.models.AnomalyStatus;
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;
/**
* The AnomalyProperty model.
*/
@Fluent
public final class AnomalyProperty implements JsonSerializable {
/*
* anomaly severity
*/
private Severity anomalySeverity;
/*
* anomaly status
*
* only return for alerting anomaly result
*/
private AnomalyStatus anomalyStatus;
/*
* value of the anomaly
*/
private Double value;
/*
* expected value of the anomaly given by smart detector
*/
private Double expectedValue;
/**
* Creates an instance of AnomalyProperty class.
*/
public AnomalyProperty() {
}
/**
* Get the anomalySeverity property: anomaly severity.
*
* @return the anomalySeverity value.
*/
public Severity getAnomalySeverity() {
return this.anomalySeverity;
}
/**
* Set the anomalySeverity property: anomaly severity.
*
* @param anomalySeverity the anomalySeverity value to set.
* @return the AnomalyProperty object itself.
*/
public AnomalyProperty setAnomalySeverity(Severity anomalySeverity) {
this.anomalySeverity = anomalySeverity;
return this;
}
/**
* Get the anomalyStatus property: anomaly status
*
* only return for alerting anomaly result.
*
* @return the anomalyStatus value.
*/
public AnomalyStatus getAnomalyStatus() {
return this.anomalyStatus;
}
/**
* Get the value property: value of the anomaly.
*
* @return the value value.
*/
public Double getValue() {
return this.value;
}
/**
* Get the expectedValue property: expected value of the anomaly given by smart detector.
*
* @return the expectedValue value.
*/
public Double getExpectedValue() {
return this.expectedValue;
}
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("anomalySeverity",
this.anomalySeverity == null ? null : this.anomalySeverity.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AnomalyProperty from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AnomalyProperty 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 AnomalyProperty.
*/
public static AnomalyProperty fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AnomalyProperty deserializedAnomalyProperty = new AnomalyProperty();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("anomalySeverity".equals(fieldName)) {
deserializedAnomalyProperty.anomalySeverity = Severity.fromString(reader.getString());
} else if ("anomalyStatus".equals(fieldName)) {
deserializedAnomalyProperty.anomalyStatus = AnomalyStatus.fromString(reader.getString());
} else if ("value".equals(fieldName)) {
deserializedAnomalyProperty.value = reader.getNullable(JsonReader::getDouble);
} else if ("expectedValue".equals(fieldName)) {
deserializedAnomalyProperty.expectedValue = reader.getNullable(JsonReader::getDouble);
} else {
reader.skipChildren();
}
}
return deserializedAnomalyProperty;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy