forked from loafle/openapi-generator-original
#5712 put @JsonValue to appropriate place in generated enum, add TypeAdapter for Gson enums, enhance tests (#5713)
This commit is contained in:
parent
71d1d05b98
commit
ffc0d32b9c
@ -347,6 +347,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
importMapping.put("JsonCreator", "com.fasterxml.jackson.annotation.JsonCreator");
|
||||
importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue");
|
||||
importMapping.put("SerializedName", "com.google.gson.annotations.SerializedName");
|
||||
importMapping.put("TypeAdapter", "com.google.gson.TypeAdapter");
|
||||
importMapping.put("JsonAdapter", "com.google.gson.annotations.JsonAdapter");
|
||||
importMapping.put("JsonReader", "com.google.gson.stream.JsonReader");
|
||||
importMapping.put("JsonWriter", "com.google.gson.stream.JsonWriter");
|
||||
importMapping.put("IOException", "java.io.IOException");
|
||||
importMapping.put("Objects", "java.util.Objects");
|
||||
importMapping.put("StringUtil", invokerPackage + ".StringUtil");
|
||||
// import JsonCreator if JsonProperty is imported
|
||||
|
@ -363,6 +363,11 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
if(additionalProperties.containsKey("gson")) {
|
||||
model.imports.add("SerializedName");
|
||||
model.imports.add("TypeAdapter");
|
||||
model.imports.add("JsonAdapter");
|
||||
model.imports.add("JsonReader");
|
||||
model.imports.add("JsonWriter");
|
||||
model.imports.add("IOException");
|
||||
}
|
||||
} else { // enum class
|
||||
//Needed imports for Jackson's JsonCreator
|
||||
|
@ -2,22 +2,24 @@
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
import java.io.IOException;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
{{/gson}}
|
||||
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
{{#gson}}
|
||||
@JsonAdapter({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class)
|
||||
{{/gson}}
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
{{/gson}}
|
||||
{{^gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
{{/gson}}
|
||||
|
||||
private {{{dataType}}} value;
|
||||
|
||||
@ -25,20 +27,21 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
{{#jackson}}
|
||||
@JsonValue
|
||||
{{/jackson}}
|
||||
public {{{dataType}}} getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
{{#jackson}}
|
||||
@JsonValue
|
||||
{{/jackson}}
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
{{#jackson}}
|
||||
|
||||
{{#jackson}}
|
||||
@JsonCreator
|
||||
{{/jackson}}
|
||||
public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
|
||||
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
@ -47,5 +50,19 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
|
||||
}
|
||||
return null;
|
||||
}
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
|
||||
public static class Adapter extends TypeAdapter<{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException {
|
||||
{{{dataType}}} value = jsonReader.{{#isInteger}}nextInt(){{/isInteger}}{{^isInteger}}next{{{dataType}}}(){{/isInteger}};
|
||||
return {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
{{/gson}}
|
||||
}
|
||||
|
@ -1,24 +1,16 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
{{#gson}}
|
||||
@JsonAdapter({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.Adapter.class)
|
||||
{{/gson}}
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
{{/gson}}
|
||||
{{^gson}}
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
{{/gson}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
|
||||
private {{{datatype}}} value;
|
||||
|
||||
@ -26,20 +18,21 @@
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
{{#jackson}}
|
||||
@JsonValue
|
||||
{{/jackson}}
|
||||
public {{{datatype}}} getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
{{#jackson}}
|
||||
@JsonValue
|
||||
{{/jackson}}
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
{{#jackson}}
|
||||
|
||||
{{#jackson}}
|
||||
@JsonCreator
|
||||
{{/jackson}}
|
||||
public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
|
||||
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
@ -48,5 +41,19 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
|
||||
public static class Adapter extends TypeAdapter<{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException {
|
||||
{{{datatype}}} value = jsonReader.{{#isInteger}}nextInt(){{/isInteger}}{{^isInteger}}next{{{datatype}}}(){{/isInteger}};
|
||||
return {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
{{/gson}}
|
||||
}
|
||||
|
@ -112,7 +112,8 @@
|
||||
<goal>wget</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<url>https://github.com/swagger-api/swagger-ui/archive/master.tar.gz</url>
|
||||
<url>http://github.com/swagger-api/swagger-ui/archive/master.tar.gz</url>
|
||||
|
||||
<unpack>true</unpack>
|
||||
<skipCache>true</skipCache>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
|
@ -41,12 +41,12 @@ public class EnumArrays {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -79,12 +79,12 @@ public class EnumArrays {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ public enum EnumClass {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -42,12 +42,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -80,12 +80,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -118,12 +118,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ public class MapTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -54,12 +54,12 @@ public class Order {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ public enum OuterEnum {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -60,12 +60,12 @@ public class Pet {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -41,12 +41,12 @@ public class EnumArrays {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -79,12 +79,12 @@ public class EnumArrays {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ public enum EnumClass {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -42,12 +42,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -80,12 +80,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -118,12 +118,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ public class MapTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -54,12 +54,12 @@ public class Order {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ public enum OuterEnum {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -60,12 +60,12 @@ public class Pet {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -1,20 +1,17 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
|
||||
import io.swagger.client.Pair;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class EnumValueTest {
|
||||
|
||||
@Test
|
||||
public void testEnumClass() {
|
||||
assertEquals(EnumClass._ABC.toString(), "_abc");
|
||||
@ -31,13 +28,19 @@ public class EnumValueTest {
|
||||
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
|
||||
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
|
||||
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
|
||||
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
|
||||
|
||||
try {
|
||||
// test serialization (object => json)
|
||||
@ -45,7 +48,7 @@ public class EnumValueTest {
|
||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
ObjectWriter ow = mapper.writer();
|
||||
String json = ow.writeValueAsString(enumTest);
|
||||
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":\"1\",\"enum_number\":\"1.1\",\"outerEnum\":null}");
|
||||
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
|
||||
|
||||
// test deserialization (json => object)
|
||||
EnumTest fromString = mapper.readValue(json, EnumTest.class);
|
||||
@ -56,7 +59,5 @@ public class EnumValueTest {
|
||||
} catch (Exception e) {
|
||||
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,12 +41,12 @@ public class EnumArrays {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -79,12 +79,12 @@ public class EnumArrays {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ public enum EnumClass {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -42,12 +42,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -80,12 +80,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -118,12 +118,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ public class MapTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -54,12 +54,12 @@ public class Order {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ public enum OuterEnum {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -60,12 +60,12 @@ public class Pet {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -41,12 +41,12 @@ public class EnumArrays {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -79,12 +79,12 @@ public class EnumArrays {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ public enum EnumClass {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -42,12 +42,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -80,12 +80,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -118,12 +118,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ public class MapTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -54,12 +54,12 @@ public class Order {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ public enum OuterEnum {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -60,12 +60,12 @@ public class Pet {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -41,12 +41,12 @@ public class EnumArrays {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -79,12 +79,12 @@ public class EnumArrays {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ public enum EnumClass {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -42,12 +42,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -80,12 +80,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
@ -118,12 +118,12 @@ public class EnumTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ public class MapTest {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -54,12 +54,12 @@ public class Order {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ public enum OuterEnum {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -60,12 +60,12 @@ public class Pet {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
@ -1,20 +1,17 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
|
||||
import io.swagger.client.Pair;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class EnumValueTest {
|
||||
|
||||
@Test
|
||||
public void testEnumClass() {
|
||||
assertEquals(EnumClass._ABC.toString(), "_abc");
|
||||
@ -31,13 +28,19 @@ public class EnumValueTest {
|
||||
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
|
||||
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
|
||||
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
|
||||
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
|
||||
|
||||
try {
|
||||
// test serialization (object => json)
|
||||
@ -45,7 +48,7 @@ public class EnumValueTest {
|
||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
ObjectWriter ow = mapper.writer();
|
||||
String json = ow.writeValueAsString(enumTest);
|
||||
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":\"1\",\"enum_number\":\"1.1\",\"outerEnum\":null}");
|
||||
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
|
||||
|
||||
// test deserialization (json => object)
|
||||
EnumTest fromString = mapper.readValue(json, EnumTest.class);
|
||||
@ -56,7 +59,5 @@ public class EnumValueTest {
|
||||
} catch (Exception e) {
|
||||
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.ReadOnlyFirst;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import android.os.Parcelable;
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import android.os.Parcelable;
|
||||
@ -30,11 +35,10 @@ public class EnumArrays implements Parcelable {
|
||||
/**
|
||||
* Gets or Sets justSymbol
|
||||
*/
|
||||
@JsonAdapter(JustSymbolEnum.Adapter.class)
|
||||
public enum JustSymbolEnum {
|
||||
@SerializedName(">=")
|
||||
GREATER_THAN_OR_EQUAL_TO(">="),
|
||||
|
||||
@SerializedName("$")
|
||||
DOLLAR("$");
|
||||
|
||||
private String value;
|
||||
@ -51,6 +55,28 @@ public class EnumArrays implements Parcelable {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static JustSymbolEnum fromValue(String text) {
|
||||
for (JustSymbolEnum b : JustSymbolEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<JustSymbolEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final JustSymbolEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JustSymbolEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return JustSymbolEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("just_symbol")
|
||||
@ -59,11 +85,10 @@ public class EnumArrays implements Parcelable {
|
||||
/**
|
||||
* Gets or Sets arrayEnum
|
||||
*/
|
||||
@JsonAdapter(ArrayEnumEnum.Adapter.class)
|
||||
public enum ArrayEnumEnum {
|
||||
@SerializedName("fish")
|
||||
FISH("fish"),
|
||||
|
||||
@SerializedName("crab")
|
||||
CRAB("crab");
|
||||
|
||||
private String value;
|
||||
@ -80,6 +105,28 @@ public class EnumArrays implements Parcelable {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static ArrayEnumEnum fromValue(String text) {
|
||||
for (ArrayEnumEnum b : ArrayEnumEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<ArrayEnumEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final ArrayEnumEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return ArrayEnumEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("array_enum")
|
||||
|
@ -18,19 +18,22 @@ import com.google.gson.annotations.SerializedName;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
/**
|
||||
* Gets or Sets EnumClass
|
||||
*/
|
||||
@JsonAdapter(EnumClass.Adapter.class)
|
||||
public enum EnumClass {
|
||||
|
||||
@SerializedName("_abc")
|
||||
_ABC("_abc"),
|
||||
|
||||
@SerializedName("-efg")
|
||||
_EFG("-efg"),
|
||||
|
||||
@SerializedName("(xyz)")
|
||||
_XYZ_("(xyz)");
|
||||
|
||||
private String value;
|
||||
@ -47,5 +50,27 @@ public enum EnumClass {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumClass fromValue(String text) {
|
||||
for (EnumClass b : EnumClass.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumClass> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumClass enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumClass read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return EnumClass.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.OuterEnum;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
@ -29,14 +34,12 @@ public class EnumTest implements Parcelable {
|
||||
/**
|
||||
* Gets or Sets enumString
|
||||
*/
|
||||
@JsonAdapter(EnumStringEnum.Adapter.class)
|
||||
public enum EnumStringEnum {
|
||||
@SerializedName("UPPER")
|
||||
UPPER("UPPER"),
|
||||
|
||||
@SerializedName("lower")
|
||||
LOWER("lower"),
|
||||
|
||||
@SerializedName("")
|
||||
EMPTY("");
|
||||
|
||||
private String value;
|
||||
@ -53,6 +56,28 @@ public class EnumTest implements Parcelable {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumStringEnum fromValue(String text) {
|
||||
for (EnumStringEnum b : EnumStringEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumStringEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumStringEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumStringEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return EnumStringEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("enum_string")
|
||||
@ -61,11 +86,10 @@ public class EnumTest implements Parcelable {
|
||||
/**
|
||||
* Gets or Sets enumInteger
|
||||
*/
|
||||
@JsonAdapter(EnumIntegerEnum.Adapter.class)
|
||||
public enum EnumIntegerEnum {
|
||||
@SerializedName("1")
|
||||
NUMBER_1(1),
|
||||
|
||||
@SerializedName("-1")
|
||||
NUMBER_MINUS_1(-1);
|
||||
|
||||
private Integer value;
|
||||
@ -82,6 +106,28 @@ public class EnumTest implements Parcelable {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumIntegerEnum fromValue(String text) {
|
||||
for (EnumIntegerEnum b : EnumIntegerEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumIntegerEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumIntegerEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException {
|
||||
Integer value = jsonReader.nextInt();
|
||||
return EnumIntegerEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("enum_integer")
|
||||
@ -90,11 +136,10 @@ public class EnumTest implements Parcelable {
|
||||
/**
|
||||
* Gets or Sets enumNumber
|
||||
*/
|
||||
@JsonAdapter(EnumNumberEnum.Adapter.class)
|
||||
public enum EnumNumberEnum {
|
||||
@SerializedName("1.1")
|
||||
NUMBER_1_DOT_1(1.1),
|
||||
|
||||
@SerializedName("-1.2")
|
||||
NUMBER_MINUS_1_DOT_2(-1.2);
|
||||
|
||||
private Double value;
|
||||
@ -111,6 +156,28 @@ public class EnumTest implements Parcelable {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumNumberEnum fromValue(String text) {
|
||||
for (EnumNumberEnum b : EnumNumberEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumNumberEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumNumberEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumNumberEnum read(final JsonReader jsonReader) throws IOException {
|
||||
Double value = jsonReader.nextDouble();
|
||||
return EnumNumberEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("enum_number")
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
import org.joda.time.DateTime;
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -34,11 +39,10 @@ public class MapTest implements Parcelable {
|
||||
/**
|
||||
* Gets or Sets inner
|
||||
*/
|
||||
@JsonAdapter(InnerEnum.Adapter.class)
|
||||
public enum InnerEnum {
|
||||
@SerializedName("UPPER")
|
||||
UPPER("UPPER"),
|
||||
|
||||
@SerializedName("lower")
|
||||
LOWER("lower");
|
||||
|
||||
private String value;
|
||||
@ -55,6 +59,28 @@ public class MapTest implements Parcelable {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static InnerEnum fromValue(String text) {
|
||||
for (InnerEnum b : InnerEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<InnerEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final InnerEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InnerEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return InnerEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("map_of_enum_string")
|
||||
|
@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import org.joda.time.DateTime;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
@ -41,14 +46,12 @@ public class Order implements Parcelable {
|
||||
/**
|
||||
* Order Status
|
||||
*/
|
||||
@JsonAdapter(StatusEnum.Adapter.class)
|
||||
public enum StatusEnum {
|
||||
@SerializedName("placed")
|
||||
PLACED("placed"),
|
||||
|
||||
@SerializedName("approved")
|
||||
APPROVED("approved"),
|
||||
|
||||
@SerializedName("delivered")
|
||||
DELIVERED("delivered");
|
||||
|
||||
private String value;
|
||||
@ -65,6 +68,28 @@ public class Order implements Parcelable {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static StatusEnum fromValue(String text) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<StatusEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return StatusEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("status")
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
@ -18,19 +18,22 @@ import com.google.gson.annotations.SerializedName;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
/**
|
||||
* Gets or Sets OuterEnum
|
||||
*/
|
||||
@JsonAdapter(OuterEnum.Adapter.class)
|
||||
public enum OuterEnum {
|
||||
|
||||
@SerializedName("placed")
|
||||
PLACED("placed"),
|
||||
|
||||
@SerializedName("approved")
|
||||
APPROVED("approved"),
|
||||
|
||||
@SerializedName("delivered")
|
||||
DELIVERED("delivered");
|
||||
|
||||
private String value;
|
||||
@ -47,5 +50,27 @@ public enum OuterEnum {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static OuterEnum fromValue(String text) {
|
||||
for (OuterEnum b : OuterEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<OuterEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final OuterEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public OuterEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return OuterEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,16 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Category;
|
||||
import io.swagger.client.model.Tag;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import android.os.Parcelable;
|
||||
@ -47,14 +52,12 @@ public class Pet implements Parcelable {
|
||||
/**
|
||||
* pet status in the store
|
||||
*/
|
||||
@JsonAdapter(StatusEnum.Adapter.class)
|
||||
public enum StatusEnum {
|
||||
@SerializedName("available")
|
||||
AVAILABLE("available"),
|
||||
|
||||
@SerializedName("pending")
|
||||
PENDING("pending"),
|
||||
|
||||
@SerializedName("sold")
|
||||
SOLD("sold");
|
||||
|
||||
private String value;
|
||||
@ -71,6 +74,28 @@ public class Pet implements Parcelable {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static StatusEnum fromValue(String text) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<StatusEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return StatusEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("status")
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Animal
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.ReadOnlyFirst;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Capitalization
|
||||
|
@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Cat
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Category
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Model for testing model with \"_class\" property
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Client
|
||||
|
@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Dog
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -28,11 +33,10 @@ public class EnumArrays {
|
||||
/**
|
||||
* Gets or Sets justSymbol
|
||||
*/
|
||||
@JsonAdapter(JustSymbolEnum.Adapter.class)
|
||||
public enum JustSymbolEnum {
|
||||
@SerializedName(">=")
|
||||
GREATER_THAN_OR_EQUAL_TO(">="),
|
||||
|
||||
@SerializedName("$")
|
||||
DOLLAR("$");
|
||||
|
||||
private String value;
|
||||
@ -49,6 +53,28 @@ public class EnumArrays {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static JustSymbolEnum fromValue(String text) {
|
||||
for (JustSymbolEnum b : JustSymbolEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<JustSymbolEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final JustSymbolEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JustSymbolEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return JustSymbolEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("just_symbol")
|
||||
@ -57,11 +83,10 @@ public class EnumArrays {
|
||||
/**
|
||||
* Gets or Sets arrayEnum
|
||||
*/
|
||||
@JsonAdapter(ArrayEnumEnum.Adapter.class)
|
||||
public enum ArrayEnumEnum {
|
||||
@SerializedName("fish")
|
||||
FISH("fish"),
|
||||
|
||||
@SerializedName("crab")
|
||||
CRAB("crab");
|
||||
|
||||
private String value;
|
||||
@ -78,6 +103,28 @@ public class EnumArrays {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static ArrayEnumEnum fromValue(String text) {
|
||||
for (ArrayEnumEnum b : ArrayEnumEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<ArrayEnumEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final ArrayEnumEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return ArrayEnumEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("array_enum")
|
||||
|
@ -16,19 +16,22 @@ package io.swagger.client.model;
|
||||
import java.util.Objects;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
/**
|
||||
* Gets or Sets EnumClass
|
||||
*/
|
||||
@JsonAdapter(EnumClass.Adapter.class)
|
||||
public enum EnumClass {
|
||||
|
||||
@SerializedName("_abc")
|
||||
_ABC("_abc"),
|
||||
|
||||
@SerializedName("-efg")
|
||||
_EFG("-efg"),
|
||||
|
||||
@SerializedName("(xyz)")
|
||||
_XYZ_("(xyz)");
|
||||
|
||||
private String value;
|
||||
@ -45,5 +48,27 @@ public enum EnumClass {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumClass fromValue(String text) {
|
||||
for (EnumClass b : EnumClass.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumClass> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumClass enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumClass read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return EnumClass.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.OuterEnum;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* EnumTest
|
||||
@ -27,14 +32,12 @@ public class EnumTest {
|
||||
/**
|
||||
* Gets or Sets enumString
|
||||
*/
|
||||
@JsonAdapter(EnumStringEnum.Adapter.class)
|
||||
public enum EnumStringEnum {
|
||||
@SerializedName("UPPER")
|
||||
UPPER("UPPER"),
|
||||
|
||||
@SerializedName("lower")
|
||||
LOWER("lower"),
|
||||
|
||||
@SerializedName("")
|
||||
EMPTY("");
|
||||
|
||||
private String value;
|
||||
@ -51,6 +54,28 @@ public class EnumTest {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumStringEnum fromValue(String text) {
|
||||
for (EnumStringEnum b : EnumStringEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumStringEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumStringEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumStringEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return EnumStringEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("enum_string")
|
||||
@ -59,11 +84,10 @@ public class EnumTest {
|
||||
/**
|
||||
* Gets or Sets enumInteger
|
||||
*/
|
||||
@JsonAdapter(EnumIntegerEnum.Adapter.class)
|
||||
public enum EnumIntegerEnum {
|
||||
@SerializedName("1")
|
||||
NUMBER_1(1),
|
||||
|
||||
@SerializedName("-1")
|
||||
NUMBER_MINUS_1(-1);
|
||||
|
||||
private Integer value;
|
||||
@ -80,6 +104,28 @@ public class EnumTest {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumIntegerEnum fromValue(String text) {
|
||||
for (EnumIntegerEnum b : EnumIntegerEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumIntegerEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumIntegerEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException {
|
||||
Integer value = jsonReader.nextInt();
|
||||
return EnumIntegerEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("enum_integer")
|
||||
@ -88,11 +134,10 @@ public class EnumTest {
|
||||
/**
|
||||
* Gets or Sets enumNumber
|
||||
*/
|
||||
@JsonAdapter(EnumNumberEnum.Adapter.class)
|
||||
public enum EnumNumberEnum {
|
||||
@SerializedName("1.1")
|
||||
NUMBER_1_DOT_1(1.1),
|
||||
|
||||
@SerializedName("-1.2")
|
||||
NUMBER_MINUS_1_DOT_2(-1.2);
|
||||
|
||||
private Double value;
|
||||
@ -109,6 +154,28 @@ public class EnumTest {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static EnumNumberEnum fromValue(String text) {
|
||||
for (EnumNumberEnum b : EnumNumberEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<EnumNumberEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final EnumNumberEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumNumberEnum read(final JsonReader jsonReader) throws IOException {
|
||||
Double value = jsonReader.nextDouble();
|
||||
return EnumNumberEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("enum_number")
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
import org.joda.time.DateTime;
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* HasOnlyReadOnly
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -32,11 +37,10 @@ public class MapTest {
|
||||
/**
|
||||
* Gets or Sets inner
|
||||
*/
|
||||
@JsonAdapter(InnerEnum.Adapter.class)
|
||||
public enum InnerEnum {
|
||||
@SerializedName("UPPER")
|
||||
UPPER("UPPER"),
|
||||
|
||||
@SerializedName("lower")
|
||||
LOWER("lower");
|
||||
|
||||
private String value;
|
||||
@ -53,6 +57,28 @@ public class MapTest {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static InnerEnum fromValue(String text) {
|
||||
for (InnerEnum b : InnerEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<InnerEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final InnerEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InnerEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return InnerEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("map_of_enum_string")
|
||||
|
@ -14,10 +14,15 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.client.model.Animal;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Model for testing model name starting with number
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* ModelApiResponse
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Model for testing reserved words
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Model for testing model name same as property name
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
@ -39,14 +44,12 @@ public class Order {
|
||||
/**
|
||||
* Order Status
|
||||
*/
|
||||
@JsonAdapter(StatusEnum.Adapter.class)
|
||||
public enum StatusEnum {
|
||||
@SerializedName("placed")
|
||||
PLACED("placed"),
|
||||
|
||||
@SerializedName("approved")
|
||||
APPROVED("approved"),
|
||||
|
||||
@SerializedName("delivered")
|
||||
DELIVERED("delivered");
|
||||
|
||||
private String value;
|
||||
@ -63,6 +66,28 @@ public class Order {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static StatusEnum fromValue(String text) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<StatusEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return StatusEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SerializedName("status")
|
||||
|
@ -14,9 +14,14 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
@ -16,19 +16,22 @@ package io.swagger.client.model;
|
||||
import java.util.Objects;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.IOException;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
/**
|
||||
* Gets or Sets OuterEnum
|
||||
*/
|
||||
@JsonAdapter(OuterEnum.Adapter.class)
|
||||
public enum OuterEnum {
|
||||
|
||||
@SerializedName("placed")
|
||||
PLACED("placed"),
|
||||
|
||||
@SerializedName("approved")
|
||||
APPROVED("approved"),
|
||||
|
||||
@SerializedName("delivered")
|
||||
DELIVERED("delivered");
|
||||
|
||||
private String value;
|
||||
@ -45,5 +48,27 @@ public enum OuterEnum {
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static OuterEnum fromValue(String text) {
|
||||
for (OuterEnum b : OuterEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Adapter extends TypeAdapter<OuterEnum> {
|
||||
@Override
|
||||
public void write(final JsonWriter jsonWriter, final OuterEnum enumeration) throws IOException {
|
||||
jsonWriter.value(enumeration.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public OuterEnum read(final JsonReader jsonReader) throws IOException {
|
||||
String value = jsonReader.nextString();
|
||||
return OuterEnum.fromValue(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user