com.huaweicloud.sdk.aom.v2.model.ValueData Maven / Gradle / Ivy
package com.huaweicloud.sdk.aom.v2.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* 指标具体数值。
*/
public class ValueData {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "metric_name")
private String metricName;
/**
* 数据的类型。取值范围只能是\"int\"或\"float\"。
*/
public static final class TypeEnum {
/**
* Enum INT for value: "int"
*/
public static final TypeEnum INT = new TypeEnum("int");
/**
* Enum FLOAT for value: "float"
*/
public static final TypeEnum FLOAT = new TypeEnum("float");
private static final Map STATIC_FIELDS = createStaticFields();
private static Map createStaticFields() {
Map map = new HashMap<>();
map.put("int", INT);
map.put("float", FLOAT);
return Collections.unmodifiableMap(map);
}
private String value;
TypeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static TypeEnum fromValue(String value) {
if (value == null) {
return null;
}
return java.util.Optional.ofNullable(STATIC_FIELDS.get(value)).orElse(new TypeEnum(value));
}
public static TypeEnum valueOf(String value) {
if (value == null) {
return null;
}
return java.util.Optional.ofNullable(STATIC_FIELDS.get(value))
.orElseThrow(() -> new IllegalArgumentException("Unexpected value '" + value + "'"));
}
@Override
public boolean equals(Object obj) {
if (obj instanceof TypeEnum) {
return this.value.equals(((TypeEnum) obj).value);
}
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "type")
private TypeEnum type;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "unit")
private String unit;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "value")
private Double value;
public ValueData withMetricName(String metricName) {
this.metricName = metricName;
return this;
}
/**
* 指标名称。长度1~255。
* @return metricName
*/
public String getMetricName() {
return metricName;
}
public void setMetricName(String metricName) {
this.metricName = metricName;
}
public ValueData withType(TypeEnum type) {
this.type = type;
return this;
}
/**
* 数据的类型。取值范围只能是\"int\"或\"float\"。
* @return type
*/
public TypeEnum getType() {
return type;
}
public void setType(TypeEnum type) {
this.type = type;
}
public ValueData withUnit(String unit) {
this.unit = unit;
return this;
}
/**
* 数据的单位。长度不超过32个字符。
* @return unit
*/
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public ValueData withValue(Double value) {
this.value = value;
return this;
}
/**
* 指标数据的值。取值范围有效的数值类型。
* minimum: 0
* @return value
*/
public Double getValue() {
return value;
}
public void setValue(Double value) {
this.value = value;
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ValueData that = (ValueData) obj;
return Objects.equals(this.metricName, that.metricName) && Objects.equals(this.type, that.type)
&& Objects.equals(this.unit, that.unit) && Objects.equals(this.value, that.value);
}
@Override
public int hashCode() {
return Objects.hash(metricName, type, unit, value);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ValueData {\n");
sb.append(" metricName: ").append(toIndentedString(metricName)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" unit: ").append(toIndentedString(unit)).append("\n");
sb.append(" value: ").append(toIndentedString(value)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}