Skip to content

Commit

Permalink
Improves the indentation of the generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
CesarCoelho committed Oct 1, 2024
1 parent e3dd3e5 commit 552a5f2
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ public void createEnumerationClass(File folder, AreaType area, ServiceType servi
method.addLine("switch (getOrdinal()) {", false);

for (EnumerationType.Item item : enumeration.getItem()) {
method.addLine(" case _" + item.getValue() + "_INDEX:", false);
method.addLine(" return \"" + item.getValue() + "\"");
method.addLine(" case _" + item.getValue() + "_INDEX:", false);
method.addLine(" return \"" + item.getValue() + "\"");
}
method.addLine(" default:", false);
method.addLine(" throw new RuntimeException(\"Unknown ordinal!\")");
method.addLine(" default:", false);
method.addLine(" throw new RuntimeException(\"Unknown ordinal!\")");
method.addLine("}", false);
method.addMethodCloseStatement();

Expand All @@ -149,9 +149,9 @@ public void createEnumerationClass(File folder, AreaType area, ServiceType servi
"Returns the enumeration element represented by the supplied string, or null if not matched.",
"The matched enumeration element, or null if not matched.", null);
method.addLine("for (int i = 0; i < _ENUMERATION_NAMES.length; i++) {", false);
method.addLine(" if (_ENUMERATION_NAMES[i].equals(s)) {", false);
method.addLine(" return _ENUMERATIONS[i]");
method.addLine(" }", false);
method.addLine(" if (_ENUMERATION_NAMES[i].equals(s)) {", false);
method.addLine(" return _ENUMERATIONS[i]");
method.addLine(" }", false);
method.addLine("}", false);
method.addLine("return null");
method.addMethodCloseStatement();
Expand Down Expand Up @@ -180,9 +180,9 @@ public void createEnumerationClass(File folder, AreaType area, ServiceType servi
"Returns the enumeration element represented by the supplied numeric value, or null if not matched.",
"The matched enumeration value, or null if not matched.", null);
method.addLine("for (int i = 0; i < _ENUMERATION_NUMERIC_VALUES.length; i++) {", false);
method.addLine(" if (" + getEnumValueCompare("_ENUMERATION_NUMERIC_VALUES[i]", "value") + ") {", false);
method.addLine(" return _ENUMERATIONS[i]");
method.addLine(" }", false);
method.addLine(" if (" + getEnumValueCompare("_ENUMERATION_NUMERIC_VALUES[i]", "value") + ") {", false);
method.addLine(" return _ENUMERATIONS[i]");
method.addLine(" }", false);
method.addLine("}", false);
method.addLine("return " + generator.getNullValue());
method.addMethodCloseStatement();
Expand Down

0 comments on commit 552a5f2

Please sign in to comment.