Skip to content
This repository was archived by the owner on Apr 27, 2021. It is now read-only.

Commit 7626729

Browse files
committed
Added additional "is" methods for Boolean values
1 parent b63d9d1 commit 7626729

File tree

1 file changed

+47
-30
lines changed

1 file changed

+47
-30
lines changed

src/main/java/org/javawebstack/openapi/client/JavaClientGenerator.java

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -392,36 +392,53 @@ private void generateSchema(StringBuilder sb, String intendation, String name, O
392392
sb.append(intendation).append(" private ").append(pType).append(" ").append(pName).append(";\n");
393393
});
394394
sb.append("\n");
395-
types.forEach((pName, pType) -> sb
396-
.append(intendation)
397-
.append(" public void set")
398-
.append(capitalize(pName))
399-
.append("(")
400-
.append(pType)
401-
.append(" ")
402-
.append(pName)
403-
.append(") {\n")
404-
.append(intendation)
405-
.append(" this.")
406-
.append(pName)
407-
.append(" = ")
408-
.append(pName)
409-
.append(";\n")
410-
.append(intendation)
411-
.append(" }\n\n")
412-
.append(intendation)
413-
.append(" public ")
414-
.append(pType)
415-
.append(" get")
416-
.append(capitalize(pName))
417-
.append("() {\n")
418-
.append(intendation)
419-
.append(" return this.")
420-
.append(pName)
421-
.append(";\n")
422-
.append(intendation)
423-
.append(" }\n\n")
424-
);
395+
types.forEach((pName, pType) -> {
396+
sb
397+
.append(intendation)
398+
.append(" public void set")
399+
.append(capitalize(pName))
400+
.append("(")
401+
.append(pType)
402+
.append(" ")
403+
.append(pName)
404+
.append(") {\n")
405+
.append(intendation)
406+
.append(" this.")
407+
.append(pName)
408+
.append(" = ")
409+
.append(pName)
410+
.append(";\n")
411+
.append(intendation)
412+
.append(" }\n\n")
413+
.append(intendation)
414+
.append(" public ")
415+
.append(pType)
416+
.append(" get")
417+
.append(capitalize(pName))
418+
.append("() {\n")
419+
.append(intendation)
420+
.append(" return this.")
421+
.append(pName)
422+
.append(";\n")
423+
.append(intendation)
424+
.append(" }\n\n");
425+
if(pType.equals("Boolean")){
426+
sb.append(intendation)
427+
.append(" public ")
428+
.append(pType)
429+
.append(" is")
430+
.append(capitalize(pName))
431+
.append("() {\n")
432+
.append(intendation)
433+
.append(" return this.")
434+
.append(pName)
435+
.append(" != null && this.")
436+
.append(pName)
437+
.append(";\n")
438+
.append(intendation)
439+
.append(" }\n\n");
440+
}
441+
});
425442
if(subSchemas.size()>0){
426443
subSchemas.forEach((subName, subSchema) -> generateSchema(sb, intendation+" ", subName, subSchema));
427444
sb.append("\n");

0 commit comments

Comments
 (0)