2020import com .google .gson .stream .JsonReader ;
2121import com .google .gson .stream .JsonWriter ;
2222import java .io .IOException ;
23+ import java .math .BigDecimal ;
2324import java .time .OffsetDateTime ;
2425import java .util .Arrays ;
2526
@@ -135,6 +136,63 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
135136 @ javax .annotation .Nullable
136137 private Boolean complete = false ;
137138
139+ /**
140+ * Various payment methods
141+ */
142+ @ JsonAdapter (PaymentMethodEnum .Adapter .class )
143+ public enum PaymentMethodEnum {
144+ NUMBER_1 (new BigDecimal ("1" )),
145+
146+ NUMBER_2 (new BigDecimal ("2" ));
147+
148+ private BigDecimal value ;
149+
150+ PaymentMethodEnum (BigDecimal value ) {
151+ this .value = value ;
152+ }
153+
154+ public BigDecimal getValue () {
155+ return value ;
156+ }
157+
158+ @ Override
159+ public String toString () {
160+ return String .valueOf (value );
161+ }
162+
163+ public static PaymentMethodEnum fromValue (BigDecimal value ) {
164+ for (PaymentMethodEnum b : PaymentMethodEnum .values ()) {
165+ if (b .value .equals (value )) {
166+ return b ;
167+ }
168+ }
169+ throw new IllegalArgumentException ("Unexpected value '" + value + "'" );
170+ }
171+
172+ public static class Adapter extends TypeAdapter <PaymentMethodEnum > {
173+ @ Override
174+ public void write (final JsonWriter jsonWriter , final PaymentMethodEnum enumeration ) throws IOException {
175+ jsonWriter .value (enumeration .getValue ());
176+ }
177+
178+ @ Override
179+ public PaymentMethodEnum read (final JsonReader jsonReader ) throws IOException {
180+ String value = jsonReader .nextString ();
181+ return PaymentMethodEnum .fromValue (new BigDecimal (value ));
182+ }
183+ }
184+
185+ public static void validateJsonElement (JsonElement jsonElement ) throws IOException {
186+ String value = jsonElement .getAsString ();
187+ PaymentMethodEnum .fromValue (new BigDecimal (value ));
188+ }
189+ }
190+
191+ public static final String SERIALIZED_NAME_PAYMENT_METHOD = "paymentMethod" ;
192+ @ SerializedName (SERIALIZED_NAME_PAYMENT_METHOD )
193+ @ javax .annotation .Nullable
194+ private PaymentMethodEnum paymentMethod = PaymentMethodEnum .NUMBER_1 ;
195+
138196 public Order () {
139197 }
140198
@@ -251,6 +309,25 @@ public void setComplete(@javax.annotation.Nullable Boolean complete) {
251309 this .complete = complete ;
252310 }
253311
312+
313+ public Order paymentMethod (@ javax .annotation .Nullable PaymentMethodEnum paymentMethod ) {
314+ this .paymentMethod = paymentMethod ;
315+ return this ;
316+ }
317+
318+ /**
319+ * Various payment methods
320+ * @return paymentMethod
321+ */
322+ @ javax .annotation .Nullable
323+ public PaymentMethodEnum getPaymentMethod () {
324+ return paymentMethod ;
325+ }
326+
327+ public void setPaymentMethod (@ javax .annotation .Nullable PaymentMethodEnum paymentMethod ) {
328+ this .paymentMethod = paymentMethod ;
329+ }
330+
254331 /**
255332 * A container for additional, undeclared properties.
256333 * This is a holder for any undeclared properties as specified with
@@ -311,13 +388,14 @@ public boolean equals(Object o) {
311388 Objects .equals (this .quantity , order .quantity ) &&
312389 Objects .equals (this .shipDate , order .shipDate ) &&
313390 Objects .equals (this .status , order .status ) &&
314- Objects .equals (this .complete , order .complete )&&
391+ Objects .equals (this .complete , order .complete ) &&
392+ Objects .equals (this .paymentMethod , order .paymentMethod )&&
315393 Objects .equals (this .additionalProperties , order .additionalProperties );
316394 }
317395
318396 @ Override
319397 public int hashCode () {
320- return Objects .hash (id , petId , quantity , shipDate , status , complete , additionalProperties );
398+ return Objects .hash (id , petId , quantity , shipDate , status , complete , paymentMethod , additionalProperties );
321399 }
322400
323401 @ Override
@@ -330,6 +408,7 @@ public String toString() {
330408 sb .append (" shipDate: " ).append (toIndentedString (shipDate )).append ("\n " );
331409 sb .append (" status: " ).append (toIndentedString (status )).append ("\n " );
332410 sb .append (" complete: " ).append (toIndentedString (complete )).append ("\n " );
411+ sb .append (" paymentMethod: " ).append (toIndentedString (paymentMethod )).append ("\n " );
333412 sb .append (" additionalProperties: " ).append (toIndentedString (additionalProperties )).append ("\n " );
334413 sb .append ("}" );
335414 return sb .toString ();
@@ -352,7 +431,7 @@ private String toIndentedString(Object o) {
352431
353432 static {
354433 // a set of all properties/fields (JSON key names)
355- openapiFields = new HashSet <String >(Arrays .asList ("id" , "petId" , "quantity" , "shipDate" , "status" , "complete" ));
434+ openapiFields = new HashSet <String >(Arrays .asList ("id" , "petId" , "quantity" , "shipDate" , "status" , "complete" , "paymentMethod" ));
356435
357436 // a set of required properties/fields (JSON key names)
358437 openapiRequiredFields = new HashSet <String >(0 );
@@ -378,6 +457,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
378457 if (jsonObj .get ("status" ) != null && !jsonObj .get ("status" ).isJsonNull ()) {
379458 StatusEnum .validateJsonElement (jsonObj .get ("status" ));
380459 }
460+ // validate the optional field `paymentMethod`
461+ if (jsonObj .get ("paymentMethod" ) != null && !jsonObj .get ("paymentMethod" ).isJsonNull ()) {
462+ PaymentMethodEnum .validateJsonElement (jsonObj .get ("paymentMethod" ));
463+ }
381464 }
382465
383466 public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
0 commit comments