[Java] Change Boolean fields of CodegenParameter and CodegenResponse to boolean. (#4747)

CodegenOperation and CodegenProperty classes have boolean fields instead of Boolean.
This fix changes Boolean fields of CodegenParameter and CodegenResponse to boolean as well.

Boolean fields are not necessary. Other classes interacting with them have to check for null
before interacting with them which is unnecessary and leads to ugly code.
This commit is contained in:
Sreenidhi Sreesha
2017-02-13 03:45:42 -08:00
committed by wing328
parent 8f2e9bce6d
commit 9cf147f215
8 changed files with 113 additions and 118 deletions

View File

@@ -58,9 +58,9 @@ public class CodegenTest {
final CodegenParameter file = op.formParams.get(1);
Assert.assertTrue(file.isFormParam);
Assert.assertEquals(file.dataType, "File");
Assert.assertNull(file.required);
Assert.assertFalse(file.required);
Assert.assertTrue(file.isFile);
Assert.assertNull(file.hasMore);
Assert.assertFalse(file.hasMore);
}
@Test(description = "read formParam values from a 2.0 spec")
@@ -87,7 +87,7 @@ public class CodegenTest {
Assert.assertTrue(idParam.isPathParam);
Assert.assertEquals(idParam.dataType, "String");
Assert.assertTrue(idParam.required);
Assert.assertNull(idParam.hasMore);
Assert.assertFalse(idParam.hasMore);
Assert.assertEquals(op.allParams.size(), 3);
Assert.assertEquals(op.formParams.size(), 2);
@@ -96,15 +96,15 @@ public class CodegenTest {
Assert.assertTrue(nameParam.isFormParam);
Assert.assertTrue(nameParam.notFile);
Assert.assertEquals(nameParam.dataType, "String");
Assert.assertNull(nameParam.required);
Assert.assertFalse(nameParam.required);
Assert.assertTrue(nameParam.hasMore);
final CodegenParameter statusParam = op.formParams.get(1);
Assert.assertTrue(statusParam.isFormParam);
Assert.assertTrue(statusParam.notFile);
Assert.assertEquals(statusParam.dataType, "String");
Assert.assertNull(statusParam.required);
Assert.assertNull(statusParam.hasMore);
Assert.assertFalse(statusParam.required);
Assert.assertFalse(statusParam.hasMore);
}
@Test(description = "handle enum array in query parameter test")