|
| 1 | +/* |
| 2 | + * Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. |
| 3 | + */ |
| 4 | + |
| 5 | +/* |
| 6 | + * SodaStore API |
| 7 | + * API for managing soda products and orders in SodaStore. |
| 8 | + * |
| 9 | + * |
| 10 | + * |
| 11 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 12 | + * https://openapi-generator.tech |
| 13 | + * Do not edit the class manually. |
| 14 | + */ |
| 15 | + |
| 16 | +package com.sap.cloud.sdk.datamodel.openapi.sample.model; |
| 17 | + |
| 18 | +import java.util.LinkedHashMap; |
| 19 | +import java.util.Map; |
| 20 | +import java.util.NoSuchElementException; |
| 21 | +import java.util.Objects; |
| 22 | +import java.util.Set; |
| 23 | + |
| 24 | +import javax.annotation.Nonnull; |
| 25 | +import javax.annotation.Nullable; |
| 26 | + |
| 27 | +import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| 28 | +import com.fasterxml.jackson.annotation.JsonAnySetter; |
| 29 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 30 | +import com.fasterxml.jackson.annotation.JsonIgnore; |
| 31 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 32 | +import com.fasterxml.jackson.annotation.JsonValue; |
| 33 | + |
| 34 | +/** |
| 35 | + * Bar |
| 36 | + */ |
| 37 | +// CHECKSTYLE:OFF |
| 38 | +public class Bar implements OneOfWithEnumDiscriminator |
| 39 | +// CHECKSTYLE:ON |
| 40 | +{ |
| 41 | + @JsonProperty( "bar" ) |
| 42 | + private String bar; |
| 43 | + |
| 44 | + /** |
| 45 | + * Gets or Sets disc |
| 46 | + */ |
| 47 | + public enum DiscEnum |
| 48 | + { |
| 49 | + /** |
| 50 | + * The DISC_BAR option of this Bar |
| 51 | + */ |
| 52 | + DISC_BAR("disc_bar"), |
| 53 | + |
| 54 | + /** |
| 55 | + * The UNKNOWN_DEFAULT_OPEN_API option of this Bar |
| 56 | + */ |
| 57 | + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); |
| 58 | + |
| 59 | + private String value; |
| 60 | + |
| 61 | + DiscEnum( String value ) |
| 62 | + { |
| 63 | + this.value = value; |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * Get the value of the enum |
| 68 | + * |
| 69 | + * @return The enum value |
| 70 | + */ |
| 71 | + @JsonValue |
| 72 | + @Nonnull |
| 73 | + public String getValue() |
| 74 | + { |
| 75 | + return value; |
| 76 | + } |
| 77 | + |
| 78 | + /** |
| 79 | + * Get the String value of the enum value. |
| 80 | + * |
| 81 | + * @return The enum value as String |
| 82 | + */ |
| 83 | + @Override |
| 84 | + @Nonnull |
| 85 | + public String toString() |
| 86 | + { |
| 87 | + return String.valueOf(value); |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * Get the enum value from a String value |
| 92 | + * |
| 93 | + * @param value |
| 94 | + * The String value |
| 95 | + * @return The enum value of type Bar |
| 96 | + */ |
| 97 | + @JsonCreator |
| 98 | + @Nonnull |
| 99 | + public static DiscEnum fromValue( @Nonnull final String value ) |
| 100 | + { |
| 101 | + for( DiscEnum b : DiscEnum.values() ) { |
| 102 | + if( b.value.equals(value) ) { |
| 103 | + return b; |
| 104 | + } |
| 105 | + } |
| 106 | + return UNKNOWN_DEFAULT_OPEN_API; |
| 107 | + } |
| 108 | + } |
| 109 | + |
| 110 | + @JsonProperty( "disc" ) |
| 111 | + private DiscEnum disc; |
| 112 | + |
| 113 | + @JsonAnySetter |
| 114 | + @JsonAnyGetter |
| 115 | + private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>(); |
| 116 | + |
| 117 | + /** |
| 118 | + * Default constructor for Bar. |
| 119 | + */ |
| 120 | + protected Bar() |
| 121 | + { |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * Set the bar of this {@link Bar} instance and return the same instance. |
| 126 | + * |
| 127 | + * @param bar |
| 128 | + * The bar of this {@link Bar} |
| 129 | + * @return The same instance of this {@link Bar} class |
| 130 | + */ |
| 131 | + @Nonnull |
| 132 | + public Bar bar( @Nullable final String bar ) |
| 133 | + { |
| 134 | + this.bar = bar; |
| 135 | + return this; |
| 136 | + } |
| 137 | + |
| 138 | + /** |
| 139 | + * Get bar |
| 140 | + * |
| 141 | + * @return bar The bar of this {@link Bar} instance. |
| 142 | + */ |
| 143 | + @Nonnull |
| 144 | + public String getBar() |
| 145 | + { |
| 146 | + return bar; |
| 147 | + } |
| 148 | + |
| 149 | + /** |
| 150 | + * Set the bar of this {@link Bar} instance. |
| 151 | + * |
| 152 | + * @param bar |
| 153 | + * The bar of this {@link Bar} |
| 154 | + */ |
| 155 | + public void setBar( @Nullable final String bar ) |
| 156 | + { |
| 157 | + this.bar = bar; |
| 158 | + } |
| 159 | + |
| 160 | + /** |
| 161 | + * Set the disc of this {@link Bar} instance and return the same instance. |
| 162 | + * |
| 163 | + * @param disc |
| 164 | + * The disc of this {@link Bar} |
| 165 | + * @return The same instance of this {@link Bar} class |
| 166 | + */ |
| 167 | + @Nonnull |
| 168 | + public Bar disc( @Nullable final DiscEnum disc ) |
| 169 | + { |
| 170 | + this.disc = disc; |
| 171 | + return this; |
| 172 | + } |
| 173 | + |
| 174 | + /** |
| 175 | + * Get disc |
| 176 | + * |
| 177 | + * @return disc The disc of this {@link Bar} instance. |
| 178 | + */ |
| 179 | + @Nonnull |
| 180 | + public DiscEnum getDisc() |
| 181 | + { |
| 182 | + return disc; |
| 183 | + } |
| 184 | + |
| 185 | + /** |
| 186 | + * Set the disc of this {@link Bar} instance. |
| 187 | + * |
| 188 | + * @param disc |
| 189 | + * The disc of this {@link Bar} |
| 190 | + */ |
| 191 | + public void setDisc( @Nullable final DiscEnum disc ) |
| 192 | + { |
| 193 | + this.disc = disc; |
| 194 | + } |
| 195 | + |
| 196 | + /** |
| 197 | + * Get the names of the unrecognizable properties of the {@link Bar}. |
| 198 | + * |
| 199 | + * @return The set of properties names |
| 200 | + */ |
| 201 | + @JsonIgnore |
| 202 | + @Nonnull |
| 203 | + public Set<String> getCustomFieldNames() |
| 204 | + { |
| 205 | + return cloudSdkCustomFields.keySet(); |
| 206 | + } |
| 207 | + |
| 208 | + /** |
| 209 | + * Get the value of an unrecognizable property of this {@link Bar} instance. |
| 210 | + * |
| 211 | + * @param name |
| 212 | + * The name of the property |
| 213 | + * @return The value of the property |
| 214 | + * @throws NoSuchElementException |
| 215 | + * If no property with the given name could be found. |
| 216 | + */ |
| 217 | + @Nullable |
| 218 | + public Object getCustomField( @Nonnull final String name ) |
| 219 | + throws NoSuchElementException |
| 220 | + { |
| 221 | + if( !cloudSdkCustomFields.containsKey(name) ) { |
| 222 | + throw new NoSuchElementException("Bar has no field with name '" + name + "'."); |
| 223 | + } |
| 224 | + return cloudSdkCustomFields.get(name); |
| 225 | + } |
| 226 | + |
| 227 | + /** |
| 228 | + * Set an unrecognizable property of this {@link Bar} instance. If the map previously contained a mapping for the |
| 229 | + * key, the old value is replaced by the specified value. |
| 230 | + * |
| 231 | + * @param customFieldName |
| 232 | + * The name of the property |
| 233 | + * @param customFieldValue |
| 234 | + * The value of the property |
| 235 | + */ |
| 236 | + @JsonIgnore |
| 237 | + public void setCustomField( @Nonnull String customFieldName, @Nullable Object customFieldValue ) |
| 238 | + { |
| 239 | + cloudSdkCustomFields.put(customFieldName, customFieldValue); |
| 240 | + } |
| 241 | + |
| 242 | + @Override |
| 243 | + public boolean equals( @Nullable final java.lang.Object o ) |
| 244 | + { |
| 245 | + if( this == o ) { |
| 246 | + return true; |
| 247 | + } |
| 248 | + if( o == null || getClass() != o.getClass() ) { |
| 249 | + return false; |
| 250 | + } |
| 251 | + final Bar bar = (Bar) o; |
| 252 | + return Objects.equals(this.cloudSdkCustomFields, bar.cloudSdkCustomFields) |
| 253 | + && Objects.equals(this.bar, bar.bar) |
| 254 | + && Objects.equals(this.disc, bar.disc); |
| 255 | + } |
| 256 | + |
| 257 | + @Override |
| 258 | + public int hashCode() |
| 259 | + { |
| 260 | + return Objects.hash(bar, disc, cloudSdkCustomFields); |
| 261 | + } |
| 262 | + |
| 263 | + @Override |
| 264 | + @Nonnull |
| 265 | + public String toString() |
| 266 | + { |
| 267 | + final StringBuilder sb = new StringBuilder(); |
| 268 | + sb.append("class Bar {\n"); |
| 269 | + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); |
| 270 | + sb.append(" disc: ").append(toIndentedString(disc)).append("\n"); |
| 271 | + cloudSdkCustomFields |
| 272 | + .forEach(( k, v ) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); |
| 273 | + sb.append("}"); |
| 274 | + return sb.toString(); |
| 275 | + } |
| 276 | + |
| 277 | + /** |
| 278 | + * Convert the given object to string with each line indented by 4 spaces (except the first line). |
| 279 | + */ |
| 280 | + private String toIndentedString( final java.lang.Object o ) |
| 281 | + { |
| 282 | + if( o == null ) { |
| 283 | + return "null"; |
| 284 | + } |
| 285 | + return o.toString().replace("\n", "\n "); |
| 286 | + } |
| 287 | + |
| 288 | + /** |
| 289 | + * Create a new {@link Bar} instance. No arguments are required. |
| 290 | + */ |
| 291 | + public static Bar create() |
| 292 | + { |
| 293 | + return new Bar(); |
| 294 | + } |
| 295 | + |
| 296 | +} |
0 commit comments