File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
templates/cli/lib/type-generation/languages Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ import '<%- attribute.relatedCollection.toLowerCase() %>.dart';
5252<% if (attribute.format === ' enum' ) { -%>
5353enum <% - toPascalCase(attribute.key) %> {
5454<% for (const element of attribute.elements) { -%>
55- <% - toPascalCase( element) %> ,
55+ <% - element %> ,
5656<% } -%>
5757}
5858
Original file line number Diff line number Diff line change @@ -9,8 +9,10 @@ class Java extends LanguageMeta {
99 case AttributeType.STRING:
1010 case AttributeType.EMAIL:
1111 case AttributeType.DATETIME:
12- case AttributeType.ENUM:
1312 type = "String";
13+ if (attribute.format === AttributeType.ENUM) {
14+ type = LanguageMeta.toPascalCase(attribute.key);
15+ }
1416 break;
1517 case AttributeType.INTEGER:
1618 type = "int";
@@ -47,6 +49,17 @@ import <%- toPascalCase(attribute.relatedCollection) %>;
4749<% } -%>
4850<% } -%>
4951public class <% - toPascalCase(collection.name) %> {
52+ <% for (const attribute of collection.attributes) { -%>
53+ <% if (attribute.format === ' enum' ) { -%>
54+
55+ public enum <% - toPascalCase(attribute.key) %> {
56+ <% for (const [index, element] of Object .entries(attribute.elements)) { -%>
57+ <% - element %><% - index < attribute.elements.length - 1 ? ' ,' : ' ;' %>
58+ <% } -%>
59+ }
60+
61+ <% } -%>
62+ <% } -%>
5063<% for (const attribute of collection.attributes) { -%>
5164 private <% - getType(attribute) %> <%= toCamelCase(attribute.key) %> ;
5265<% } -%>
You can’t perform that action at this time.
0 commit comments