[java] add useNullForUnknownEnumValue option (#633)

This commit is contained in:
Jérémie Bresson 2018-07-26 11:00:45 +02:00 committed by GitHub
parent 44d419c1a1
commit a8e8acead7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
282 changed files with 449 additions and 419 deletions

View File

@ -27,7 +27,7 @@ fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate --artifact-id petstore-java-client-jersey1 -t modules/openapi-generator/src/main/resources/Java -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -o samples/client/petstore/java/jersey1 -DhideGenerationTimestamp=true --library=jersey1 $@" ags="generate --artifact-id petstore-java-client-jersey1 -t modules/openapi-generator/src/main/resources/Java -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -o samples/client/petstore/java/jersey1 -DhideGenerationTimestamp=true --library=jersey1 --additional-properties useNullForUnknownEnumValue=true $@"
echo "Removing files and folders under samples/client/petstore/java/jersey1/src/main" echo "Removing files and folders under samples/client/petstore/java/jersey1/src/main"
rm -rf samples/client/petstore/java/jersey1/src/main rm -rf samples/client/petstore/java/jersey1/src/main

View File

@ -1,4 +1,7 @@
{ {
"library": "jersey2", "library": "jersey2",
"artifactId": "petstore-jersey2" "artifactId": "petstore-jersey2",
"additionalProperties" : {
"useNullForUnknownEnumValue" : true
}
} }

View File

@ -25,6 +25,17 @@ For the templates, this is not an API change, because the same values are availa
If you have your own `Codegen` class (to support your own generator for example) then you might get some compile error due to the change. If you have your own `Codegen` class (to support your own generator for example) then you might get some compile error due to the change.
==== Java
Schema with enum values are mapped to java enum in the generated code.
In previous version, when an unknown value was deserialized, the value was set to `null`.
With `3.2.0` a new option is introduced: `useNullForUnknownEnumValue`.
* When set to `false` (default value), an Exception (`IllegalArgumentException`) is thrown when the value not available in the enum.
* When set to `true`, unknown values are mapped to `null` as it was the case in previous versions.
=== From 3.0.x to 3.1.0 === From 3.0.x to 3.1.0
Version `3.1.0` is the first minor version of OpenAPI-Generator, in comparison to `3.0.3` it contains some breaking changes, but with the possibility to fallback to the old behavior. Version `3.1.0` is the first minor version of OpenAPI-Generator, in comparison to `3.0.3` it contains some breaking changes, but with the possibility to fallback to the old behavior.

View File

@ -65,6 +65,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
public static final String DISABLE_HTML_ESCAPING = "disableHtmlEscaping"; public static final String DISABLE_HTML_ESCAPING = "disableHtmlEscaping";
public static final String BOOLEAN_GETTER_PREFIX = "booleanGetterPrefix"; public static final String BOOLEAN_GETTER_PREFIX = "booleanGetterPrefix";
public static final String BOOLEAN_GETTER_PREFIX_DEFAULT = "get"; public static final String BOOLEAN_GETTER_PREFIX_DEFAULT = "get";
public static final String USE_NULL_FOR_UNKNOWN_ENUM_VALUE = "useNullForUnknownEnumValue";
protected String dateLibrary = "threetenbp"; protected String dateLibrary = "threetenbp";
protected boolean supportAsync = false; protected boolean supportAsync = false;
@ -99,6 +100,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
protected boolean supportJava6= false; protected boolean supportJava6= false;
protected boolean disableHtmlEscaping = false; protected boolean disableHtmlEscaping = false;
protected String booleanGetterPrefix = BOOLEAN_GETTER_PREFIX_DEFAULT; protected String booleanGetterPrefix = BOOLEAN_GETTER_PREFIX_DEFAULT;
protected boolean useNullForUnknownEnumValue = false;
public AbstractJavaCodegen() { public AbstractJavaCodegen() {
super(); super();
@ -213,6 +215,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
} }
additionalProperties.put(BOOLEAN_GETTER_PREFIX, booleanGetterPrefix); additionalProperties.put(BOOLEAN_GETTER_PREFIX, booleanGetterPrefix);
if (additionalProperties.containsKey(USE_NULL_FOR_UNKNOWN_ENUM_VALUE)) {
this.setUseNullForUnknownEnumValue(Boolean.valueOf(additionalProperties.get(USE_NULL_FOR_UNKNOWN_ENUM_VALUE).toString()));
}
additionalProperties.put(USE_NULL_FOR_UNKNOWN_ENUM_VALUE, useNullForUnknownEnumValue);
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
} else if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) { } else if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) {
@ -1254,6 +1261,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
this.booleanGetterPrefix = booleanGetterPrefix; this.booleanGetterPrefix = booleanGetterPrefix;
} }
public void setUseNullForUnknownEnumValue(boolean useNullForUnknownEnumValue) {
this.useNullForUnknownEnumValue = useNullForUnknownEnumValue;
}
@Override @Override
public String escapeQuotationMark(String input) { public String escapeQuotationMark(String input) {
// remove " to avoid code injection // remove " to avoid code injection

View File

@ -48,7 +48,7 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
{{#gson}} {{#gson}}

View File

@ -39,7 +39,7 @@
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
{{#gson}} {{#gson}}

View File

@ -39,6 +39,6 @@
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -37,6 +37,6 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -28,6 +28,6 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + v + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -28,6 +28,6 @@ public enum {{datatypeWithEnum}} {
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + v + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -42,7 +42,7 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -39,6 +39,6 @@
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -37,6 +37,6 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -37,7 +37,7 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
{{/jackson}} {{/jackson}}
} }

View File

@ -28,6 +28,6 @@ public enum {{datatypeWithEnum}} {
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + v + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -38,6 +38,6 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -39,6 +39,6 @@
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -37,6 +37,6 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -39,6 +39,6 @@
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -37,6 +37,6 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -31,6 +31,6 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -39,6 +39,6 @@
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -37,6 +37,6 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -39,6 +39,6 @@
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -37,6 +37,6 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -37,6 +37,6 @@ if (String.valueOf(b.value).equals(text)) {
return b; return b;
} }
} }
return null; {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + text + "'");{{/useNullForUnknownEnumValue}}
} }
} }

View File

@ -98,6 +98,7 @@ public class AbstractJavaCodegenTest {
Assert.assertEquals(codegen.getInvokerPackage(), "org.openapitools"); Assert.assertEquals(codegen.getInvokerPackage(), "org.openapitools");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "org.openapitools"); Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "org.openapitools");
Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX), "get"); Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX), "get");
Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.USE_NULL_FOR_UNKNOWN_ENUM_VALUE), Boolean.FALSE);
} }
@Test @Test
@ -108,6 +109,7 @@ public class AbstractJavaCodegenTest {
codegen.setApiPackage("xyz.yyyyy.zzzzzzz.api"); codegen.setApiPackage("xyz.yyyyy.zzzzzzz.api");
codegen.setInvokerPackage("xyz.yyyyy.zzzzzzz.invoker"); codegen.setInvokerPackage("xyz.yyyyy.zzzzzzz.invoker");
codegen.setBooleanGetterPrefix("is"); codegen.setBooleanGetterPrefix("is");
codegen.setUseNullForUnknownEnumValue(true);
codegen.processOpts(); codegen.processOpts();
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE); Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
@ -119,6 +121,7 @@ public class AbstractJavaCodegenTest {
Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.invoker"); Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.zzzzzzz.invoker");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "xyz.yyyyy.zzzzzzz.invoker"); Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "xyz.yyyyy.zzzzzzz.invoker");
Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX), "is"); Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX), "is");
Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.USE_NULL_FOR_UNKNOWN_ENUM_VALUE), Boolean.TRUE);
} }
@Test @Test
@ -129,6 +132,7 @@ public class AbstractJavaCodegenTest {
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.yyyyy.api.oooooo"); codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.yyyyy.api.oooooo");
codegen.additionalProperties().put(CodegenConstants.INVOKER_PACKAGE, "xyz.yyyyy.invoker.oooooo"); codegen.additionalProperties().put(CodegenConstants.INVOKER_PACKAGE, "xyz.yyyyy.invoker.oooooo");
codegen.additionalProperties().put(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX, "getBoolean"); codegen.additionalProperties().put(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX, "getBoolean");
codegen.additionalProperties().put(AbstractJavaCodegen.USE_NULL_FOR_UNKNOWN_ENUM_VALUE, "true");
codegen.processOpts(); codegen.processOpts();
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE); Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE);
@ -140,6 +144,7 @@ public class AbstractJavaCodegenTest {
Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.invoker.oooooo"); Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.invoker.oooooo");
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "xyz.yyyyy.invoker.oooooo"); Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.INVOKER_PACKAGE), "xyz.yyyyy.invoker.oooooo");
Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX), "getBoolean"); Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.BOOLEAN_GETTER_PREFIX), "getBoolean");
Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaCodegen.USE_NULL_FOR_UNKNOWN_ENUM_VALUE), Boolean.TRUE);
} }
@Test @Test

View File

@ -59,7 +59,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -97,7 +97,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -53,7 +53,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -60,7 +60,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -100,7 +100,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -138,7 +138,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -176,7 +176,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -64,7 +64,7 @@ public class MapTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -72,7 +72,7 @@ public class Order {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -53,7 +53,7 @@ public enum OuterEnum {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -78,7 +78,7 @@ public class Pet {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -59,7 +59,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -97,7 +97,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -53,7 +53,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -60,7 +60,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -100,7 +100,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -138,7 +138,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -176,7 +176,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -64,7 +64,7 @@ public class MapTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -72,7 +72,7 @@ public class Order {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -53,7 +53,7 @@ public enum OuterEnum {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -78,7 +78,7 @@ public class Pet {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -59,7 +59,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -97,7 +97,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -53,7 +53,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -60,7 +60,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -100,7 +100,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -138,7 +138,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -176,7 +176,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -64,7 +64,7 @@ public class MapTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -72,7 +72,7 @@ public class Order {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -53,7 +53,7 @@ public enum OuterEnum {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -78,7 +78,7 @@ public class Pet {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -63,7 +63,7 @@ public class EnumArrays implements Parcelable {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<JustSymbolEnum> { public static class Adapter extends TypeAdapter<JustSymbolEnum> {
@ -114,7 +114,7 @@ public class EnumArrays implements Parcelable {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<ArrayEnumEnum> { public static class Adapter extends TypeAdapter<ArrayEnumEnum> {

View File

@ -58,7 +58,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumClass> { public static class Adapter extends TypeAdapter<EnumClass> {

View File

@ -64,7 +64,7 @@ public class EnumTest implements Parcelable {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumStringEnum> { public static class Adapter extends TypeAdapter<EnumStringEnum> {
@ -117,7 +117,7 @@ public class EnumTest implements Parcelable {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumStringRequiredEnum> { public static class Adapter extends TypeAdapter<EnumStringRequiredEnum> {
@ -168,7 +168,7 @@ public class EnumTest implements Parcelable {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumIntegerEnum> { public static class Adapter extends TypeAdapter<EnumIntegerEnum> {
@ -219,7 +219,7 @@ public class EnumTest implements Parcelable {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumNumberEnum> { public static class Adapter extends TypeAdapter<EnumNumberEnum> {

View File

@ -69,7 +69,7 @@ public class MapTest implements Parcelable {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<InnerEnum> { public static class Adapter extends TypeAdapter<InnerEnum> {

View File

@ -80,7 +80,7 @@ public class Order implements Parcelable {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<StatusEnum> { public static class Adapter extends TypeAdapter<StatusEnum> {

View File

@ -58,7 +58,7 @@ public enum OuterEnum {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<OuterEnum> { public static class Adapter extends TypeAdapter<OuterEnum> {

View File

@ -87,7 +87,7 @@ public class Pet implements Parcelable {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<StatusEnum> { public static class Adapter extends TypeAdapter<StatusEnum> {

View File

@ -61,7 +61,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<JustSymbolEnum> { public static class Adapter extends TypeAdapter<JustSymbolEnum> {
@ -112,7 +112,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<ArrayEnumEnum> { public static class Adapter extends TypeAdapter<ArrayEnumEnum> {

View File

@ -56,7 +56,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumClass> { public static class Adapter extends TypeAdapter<EnumClass> {

View File

@ -62,7 +62,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumStringEnum> { public static class Adapter extends TypeAdapter<EnumStringEnum> {
@ -115,7 +115,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumStringRequiredEnum> { public static class Adapter extends TypeAdapter<EnumStringRequiredEnum> {
@ -166,7 +166,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumIntegerEnum> { public static class Adapter extends TypeAdapter<EnumIntegerEnum> {
@ -217,7 +217,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumNumberEnum> { public static class Adapter extends TypeAdapter<EnumNumberEnum> {

View File

@ -67,7 +67,7 @@ public class MapTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<InnerEnum> { public static class Adapter extends TypeAdapter<InnerEnum> {

View File

@ -78,7 +78,7 @@ public class Order {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<StatusEnum> { public static class Adapter extends TypeAdapter<StatusEnum> {

View File

@ -56,7 +56,7 @@ public enum OuterEnum {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<OuterEnum> { public static class Adapter extends TypeAdapter<OuterEnum> {

View File

@ -85,7 +85,7 @@ public class Pet {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<StatusEnum> { public static class Adapter extends TypeAdapter<StatusEnum> {

View File

@ -61,7 +61,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<JustSymbolEnum> { public static class Adapter extends TypeAdapter<JustSymbolEnum> {
@ -112,7 +112,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<ArrayEnumEnum> { public static class Adapter extends TypeAdapter<ArrayEnumEnum> {

View File

@ -56,7 +56,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumClass> { public static class Adapter extends TypeAdapter<EnumClass> {

View File

@ -62,7 +62,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumStringEnum> { public static class Adapter extends TypeAdapter<EnumStringEnum> {
@ -115,7 +115,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumStringRequiredEnum> { public static class Adapter extends TypeAdapter<EnumStringRequiredEnum> {
@ -166,7 +166,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumIntegerEnum> { public static class Adapter extends TypeAdapter<EnumIntegerEnum> {
@ -217,7 +217,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumNumberEnum> { public static class Adapter extends TypeAdapter<EnumNumberEnum> {

View File

@ -67,7 +67,7 @@ public class MapTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<InnerEnum> { public static class Adapter extends TypeAdapter<InnerEnum> {

View File

@ -78,7 +78,7 @@ public class Order {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<StatusEnum> { public static class Adapter extends TypeAdapter<StatusEnum> {

View File

@ -56,7 +56,7 @@ public enum OuterEnum {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<OuterEnum> { public static class Adapter extends TypeAdapter<OuterEnum> {

View File

@ -85,7 +85,7 @@ public class Pet {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<StatusEnum> { public static class Adapter extends TypeAdapter<StatusEnum> {

View File

@ -59,7 +59,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -97,7 +97,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -53,7 +53,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -60,7 +60,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -100,7 +100,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -138,7 +138,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -176,7 +176,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -64,7 +64,7 @@ public class MapTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -72,7 +72,7 @@ public class Order {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -53,7 +53,7 @@ public enum OuterEnum {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -78,7 +78,7 @@ public class Pet {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -64,7 +64,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -104,7 +104,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -55,7 +55,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -65,7 +65,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -107,7 +107,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -147,7 +147,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -187,7 +187,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -73,7 +73,7 @@ public class MapTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -85,7 +85,7 @@ public class Order {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -55,7 +55,7 @@ public enum OuterEnum {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -103,7 +103,7 @@ public class Pet {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -59,7 +59,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -97,7 +97,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -53,7 +53,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -60,7 +60,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -100,7 +100,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -138,7 +138,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -176,7 +176,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -64,7 +64,7 @@ public class MapTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -72,7 +72,7 @@ public class Order {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -53,7 +53,7 @@ public enum OuterEnum {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -78,7 +78,7 @@ public class Pet {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -61,7 +61,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<JustSymbolEnum> { public static class Adapter extends TypeAdapter<JustSymbolEnum> {
@ -112,7 +112,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<ArrayEnumEnum> { public static class Adapter extends TypeAdapter<ArrayEnumEnum> {

View File

@ -56,7 +56,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumClass> { public static class Adapter extends TypeAdapter<EnumClass> {

View File

@ -62,7 +62,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumStringEnum> { public static class Adapter extends TypeAdapter<EnumStringEnum> {
@ -115,7 +115,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumStringRequiredEnum> { public static class Adapter extends TypeAdapter<EnumStringRequiredEnum> {
@ -166,7 +166,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumIntegerEnum> { public static class Adapter extends TypeAdapter<EnumIntegerEnum> {
@ -217,7 +217,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<EnumNumberEnum> { public static class Adapter extends TypeAdapter<EnumNumberEnum> {

View File

@ -67,7 +67,7 @@ public class MapTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<InnerEnum> { public static class Adapter extends TypeAdapter<InnerEnum> {

View File

@ -78,7 +78,7 @@ public class Order {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<StatusEnum> { public static class Adapter extends TypeAdapter<StatusEnum> {

View File

@ -56,7 +56,7 @@ public enum OuterEnum {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<OuterEnum> { public static class Adapter extends TypeAdapter<OuterEnum> {

View File

@ -85,7 +85,7 @@ public class Pet {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
public static class Adapter extends TypeAdapter<StatusEnum> { public static class Adapter extends TypeAdapter<StatusEnum> {

View File

@ -61,7 +61,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -99,7 +99,7 @@ public class EnumArrays {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -55,7 +55,7 @@ public enum EnumClass {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

View File

@ -62,7 +62,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -102,7 +102,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -140,7 +140,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }
@ -178,7 +178,7 @@ public class EnumTest {
return b; return b;
} }
} }
return null; throw new IllegalArgumentException("Unexpected value '" + text + "'");
} }
} }

Some files were not shown because too many files have changed in this diff Show More