Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
{{#jackson}}
@JsonCreator
{{/jackson}}
@Nonnull public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(@Nonnull final {{{dataType}}} value) {
{{#isNullable}}@Nullable{{/isNullable}}{{^isNullable}}@Nonnull{{/isNullable}} public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(@Nonnull final {{{dataType}}} value) {
for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
if (b.value.{{^isString}}equals{{/isString}}{{#isString}}{{#useEnumCaseInsensitive}}equalsIgnoreCase{{/useEnumCaseInsensitive}}{{^useEnumCaseInsensitive}}equals{{/useEnumCaseInsensitive}}{{/isString}}(value)) {
return b;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@
"type": "number",
"format": "float"
},
"diet": {
"type": "string",
"enum": ["sugar", "zero", "light"],
"nullable": true
},
"embedding":{
"type": "array",
"items": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,68 @@ public class Soda
@JsonProperty("price")
private Float price;

/**
* Gets or Sets diet
*/
public enum DietEnum {
/**
* The SUGAR option of this Soda
*/
SUGAR("sugar"),

/**
* The ZERO option of this Soda
*/
ZERO("zero"),

/**
* The LIGHT option of this Soda
*/
LIGHT("light");

private String value;

DietEnum(String value) {
this.value = value;
}

/**
* Get the value of the enum
* @return The enum value
*/
@JsonValue
@Nonnull public String getValue() {
return value;
}

/**
* Get the String value of the enum value.
* @return The enum value as String
*/
@Override
@Nonnull public String toString() {
return String.valueOf(value);
}

/**
* Get the enum value from a String value
* @param value The String value
* @return The enum value of type Soda
*/
@JsonCreator
@Nullable public static DietEnum fromValue(@Nonnull final String value) {
for (DietEnum b : DietEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
return null;
}
}

@JsonProperty("diet")
private DietEnum diet;

@JsonProperty("embedding")
private float[] embedding;

Expand Down Expand Up @@ -244,6 +306,35 @@ public void setPrice( @Nonnull final Float price) {
this.price = price;
}

/**
* Set the diet of this {@link Soda} instance and return the same instance.
*
* @param diet The diet of this {@link Soda}
* @return The same instance of this {@link Soda} class
*/
@Nonnull public Soda diet( @Nullable final DietEnum diet) {
this.diet = diet;
return this;
}

/**
* Get diet
* @return diet The diet of this {@link Soda} instance.
*/
@Nullable
public DietEnum getDiet() {
return diet;
}

/**
* Set the diet of this {@link Soda} instance.
*
* @param diet The diet of this {@link Soda}
*/
public void setDiet( @Nullable final DietEnum diet) {
this.diet = diet;
}

/**
* Set the embedding of this {@link Soda} instance and return the same instance.
*
Expand Down Expand Up @@ -315,6 +406,7 @@ public Map<String, Object> toMap()
if( isAvailable != null ) declaredFields.put("isAvailable", isAvailable);
if( flavor != null ) declaredFields.put("flavor", flavor);
if( price != null ) declaredFields.put("price", price);
if( diet != null ) declaredFields.put("diet", diet);
if( embedding != null ) declaredFields.put("embedding", embedding);
return declaredFields;
}
Expand Down Expand Up @@ -348,12 +440,13 @@ public boolean equals(@Nullable final java.lang.Object o) {
Objects.equals(this.isAvailable, soda.isAvailable) &&
Objects.equals(this.flavor, soda.flavor) &&
Objects.equals(this.price, soda.price) &&
Objects.equals(this.diet, soda.diet) &&
Arrays.equals(this.embedding, soda.embedding);
}

@Override
public int hashCode() {
return Objects.hash(id, name, brand, isAvailable, flavor, price, Arrays.hashCode(embedding), cloudSdkCustomFields);
return Objects.hash(id, name, brand, isAvailable, flavor, price, diet, Arrays.hashCode(embedding), cloudSdkCustomFields);
}

@Override
Expand All @@ -366,6 +459,7 @@ public int hashCode() {
sb.append(" isAvailable: ").append(toIndentedString(isAvailable)).append("\n");
sb.append(" flavor: ").append(toIndentedString(flavor)).append("\n");
sb.append(" price: ").append(toIndentedString(price)).append("\n");
sb.append(" diet: ").append(toIndentedString(diet)).append("\n");
sb.append(" embedding: ").append(toIndentedString(embedding)).append("\n");
cloudSdkCustomFields.forEach((k,v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
sb.append("}");
Expand Down
Loading