|
| 1 | +/* |
| 2 | + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 3 | + * This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 4 | + * Copyright 2019-Present Datadog, Inc. |
| 5 | + */ |
| 6 | + |
| 7 | +package com.datadog.api.client.v1.model; |
| 8 | + |
| 9 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 10 | +import com.fasterxml.jackson.annotation.JsonIgnore; |
| 11 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 12 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 13 | +import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| 14 | +import java.util.Objects; |
| 15 | + |
| 16 | +/** Calendar interval definition. */ |
| 17 | +@JsonPropertyOrder({ |
| 18 | + CalendarInterval.JSON_PROPERTY_ALIGNMENT, |
| 19 | + CalendarInterval.JSON_PROPERTY_QUANTITY, |
| 20 | + CalendarInterval.JSON_PROPERTY_TIMEZONE, |
| 21 | + CalendarInterval.JSON_PROPERTY_TYPE |
| 22 | +}) |
| 23 | +@jakarta.annotation.Generated( |
| 24 | + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") |
| 25 | +public class CalendarInterval { |
| 26 | + @JsonIgnore public boolean unparsed = false; |
| 27 | + public static final String JSON_PROPERTY_ALIGNMENT = "alignment"; |
| 28 | + private String alignment; |
| 29 | + |
| 30 | + public static final String JSON_PROPERTY_QUANTITY = "quantity"; |
| 31 | + private Long quantity; |
| 32 | + |
| 33 | + public static final String JSON_PROPERTY_TIMEZONE = "timezone"; |
| 34 | + private String timezone; |
| 35 | + |
| 36 | + public static final String JSON_PROPERTY_TYPE = "type"; |
| 37 | + private CalendarIntervalType type; |
| 38 | + |
| 39 | + public CalendarInterval() {} |
| 40 | + |
| 41 | + @JsonCreator |
| 42 | + public CalendarInterval( |
| 43 | + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CalendarIntervalType type) { |
| 44 | + this.type = type; |
| 45 | + this.unparsed |= !type.isValid(); |
| 46 | + } |
| 47 | + |
| 48 | + public CalendarInterval alignment(String alignment) { |
| 49 | + this.alignment = alignment; |
| 50 | + return this; |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * Alignment of the interval. |
| 55 | + * |
| 56 | + * @return alignment |
| 57 | + */ |
| 58 | + @jakarta.annotation.Nullable |
| 59 | + @JsonProperty(JSON_PROPERTY_ALIGNMENT) |
| 60 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 61 | + public String getAlignment() { |
| 62 | + return alignment; |
| 63 | + } |
| 64 | + |
| 65 | + public void setAlignment(String alignment) { |
| 66 | + this.alignment = alignment; |
| 67 | + } |
| 68 | + |
| 69 | + public CalendarInterval quantity(Long quantity) { |
| 70 | + this.quantity = quantity; |
| 71 | + return this; |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * Quantity of the interval. |
| 76 | + * |
| 77 | + * @return quantity |
| 78 | + */ |
| 79 | + @jakarta.annotation.Nullable |
| 80 | + @JsonProperty(JSON_PROPERTY_QUANTITY) |
| 81 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 82 | + public Long getQuantity() { |
| 83 | + return quantity; |
| 84 | + } |
| 85 | + |
| 86 | + public void setQuantity(Long quantity) { |
| 87 | + this.quantity = quantity; |
| 88 | + } |
| 89 | + |
| 90 | + public CalendarInterval timezone(String timezone) { |
| 91 | + this.timezone = timezone; |
| 92 | + return this; |
| 93 | + } |
| 94 | + |
| 95 | + /** |
| 96 | + * Timezone for the interval. |
| 97 | + * |
| 98 | + * @return timezone |
| 99 | + */ |
| 100 | + @jakarta.annotation.Nullable |
| 101 | + @JsonProperty(JSON_PROPERTY_TIMEZONE) |
| 102 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 103 | + public String getTimezone() { |
| 104 | + return timezone; |
| 105 | + } |
| 106 | + |
| 107 | + public void setTimezone(String timezone) { |
| 108 | + this.timezone = timezone; |
| 109 | + } |
| 110 | + |
| 111 | + public CalendarInterval type(CalendarIntervalType type) { |
| 112 | + this.type = type; |
| 113 | + this.unparsed |= !type.isValid(); |
| 114 | + return this; |
| 115 | + } |
| 116 | + |
| 117 | + /** |
| 118 | + * Type of calendar interval. |
| 119 | + * |
| 120 | + * @return type |
| 121 | + */ |
| 122 | + @JsonProperty(JSON_PROPERTY_TYPE) |
| 123 | + @JsonInclude(value = JsonInclude.Include.ALWAYS) |
| 124 | + public CalendarIntervalType getType() { |
| 125 | + return type; |
| 126 | + } |
| 127 | + |
| 128 | + public void setType(CalendarIntervalType type) { |
| 129 | + if (!type.isValid()) { |
| 130 | + this.unparsed = true; |
| 131 | + } |
| 132 | + this.type = type; |
| 133 | + } |
| 134 | + |
| 135 | + /** Return true if this CalendarInterval object is equal to o. */ |
| 136 | + @Override |
| 137 | + public boolean equals(Object o) { |
| 138 | + if (this == o) { |
| 139 | + return true; |
| 140 | + } |
| 141 | + if (o == null || getClass() != o.getClass()) { |
| 142 | + return false; |
| 143 | + } |
| 144 | + CalendarInterval calendarInterval = (CalendarInterval) o; |
| 145 | + return Objects.equals(this.alignment, calendarInterval.alignment) |
| 146 | + && Objects.equals(this.quantity, calendarInterval.quantity) |
| 147 | + && Objects.equals(this.timezone, calendarInterval.timezone) |
| 148 | + && Objects.equals(this.type, calendarInterval.type); |
| 149 | + } |
| 150 | + |
| 151 | + @Override |
| 152 | + public int hashCode() { |
| 153 | + return Objects.hash(alignment, quantity, timezone, type); |
| 154 | + } |
| 155 | + |
| 156 | + @Override |
| 157 | + public String toString() { |
| 158 | + StringBuilder sb = new StringBuilder(); |
| 159 | + sb.append("class CalendarInterval {\n"); |
| 160 | + sb.append(" alignment: ").append(toIndentedString(alignment)).append("\n"); |
| 161 | + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); |
| 162 | + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); |
| 163 | + sb.append(" type: ").append(toIndentedString(type)).append("\n"); |
| 164 | + sb.append('}'); |
| 165 | + return sb.toString(); |
| 166 | + } |
| 167 | + |
| 168 | + /** |
| 169 | + * Convert the given object to string with each line indented by 4 spaces (except the first line). |
| 170 | + */ |
| 171 | + private String toIndentedString(Object o) { |
| 172 | + if (o == null) { |
| 173 | + return "null"; |
| 174 | + } |
| 175 | + return o.toString().replace("\n", "\n "); |
| 176 | + } |
| 177 | +} |
0 commit comments