@@ -50,7 +50,7 @@ class Java extends LanguageMeta {
50
50
* You can regenerate it by running \`appwrite types -l java ${this.getCurrentDirectory()}\`.
51
51
*/
52
52
53
- import java.util.* ;
53
+ import java.util.Objects ;
54
54
<% for (const attribute of collection.attributes) { -%>
55
55
<% if (attribute.type === ' relationship' ) { -%>
56
56
import io.appwrite.models.<% - toPascalCase(attribute.relatedCollection) %> ;
@@ -61,63 +61,63 @@ public class <%- toPascalCase(collection.name) %> {
61
61
<% for (const attribute of collection.attributes) { -%>
62
62
<% if (attribute.format === ' enum' ) { -%>
63
63
64
- public enum <% - toPascalCase(attribute.key) %> {
64
+ public enum <% - toPascalCase(attribute.key) %> {
65
65
<% for (const [index, element] of Object .entries(attribute.elements)) { -%>
66
- <% - strict ? toSnakeCase (element) : element %><% - index < attribute.elements.length - 1 ? ' ,' : ' ;' %>
66
+ <% - strict ? toUpperSnakeCase (element) : element %><% - index < attribute.elements.length - 1 ? ' ,' : ' ;' %>
67
67
<% } -%>
68
- }
68
+ }
69
69
70
70
<% } -%>
71
71
<% } -%>
72
72
<% for (const attribute of collection.attributes) { -%>
73
- private <% - getType(attribute) %> <% - strict ? toCamelCase(attribute.key) : attribute.key %> ;
73
+ private <% - getType(attribute) %> <% - strict ? toCamelCase(attribute.key) : attribute.key %> ;
74
74
<% } -%>
75
75
76
- public <% - toPascalCase(collection.name) %> () {
77
- }
76
+ public <% - toPascalCase(collection.name) %> () {
77
+ }
78
78
79
- public <% - toPascalCase(collection.name) %> (
79
+ public <% - toPascalCase(collection.name) %> (
80
80
<% for (const [index, attribute] of Object .entries(collection.attributes)) { -%>
81
- <% - getType(attribute) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %><% - index < collection.attributes.length - 1 ? ' ,' : ' ' %>
81
+ <% - getType(attribute) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %><% - index < collection.attributes.length - 1 ? ' ,' : ' ' %>
82
82
<% } -%>
83
- ) {
83
+ ) {
84
84
<% for (const attribute of collection.attributes) { -%>
85
- this.<%= strict ? toCamelCase(attribute.key) : attribute.key %> = <%= strict ? toCamelCase(attribute.key) : attribute.key %> ;
85
+ this.<%= strict ? toCamelCase(attribute.key) : attribute.key %> = <%= strict ? toCamelCase(attribute.key) : attribute.key %> ;
86
86
<% } -%>
87
- }
87
+ }
88
88
89
89
<% for (const attribute of collection.attributes) { -%>
90
- public <% - getType(attribute) %> get<% - toPascalCase(attribute.key) %> () {
91
- return <%= strict ? toCamelCase(attribute.key) : attribute.key %> ;
92
- }
90
+ public <% - getType(attribute) %> get<% - toPascalCase(attribute.key) %> () {
91
+ return <%= strict ? toCamelCase(attribute.key) : attribute.key %> ;
92
+ }
93
93
94
- public void set<% - toPascalCase(attribute.key) %> (<% - getType(attribute) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %> ) {
95
- this.<%= strict ? toCamelCase(attribute.key) : attribute.key %> = <%= strict ? toCamelCase(attribute.key) : attribute.key %> ;
96
- }
94
+ public void set<% - toPascalCase(attribute.key) %> (<% - getType(attribute) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %> ) {
95
+ this.<%= strict ? toCamelCase(attribute.key) : attribute.key %> = <%= strict ? toCamelCase(attribute.key) : attribute.key %> ;
96
+ }
97
97
98
98
<% } -%>
99
- @Override
100
- public boolean equals(Object obj) {
101
- if (this == obj) return true;
102
- if (obj == null || getClass() != obj.getClass()) return false;
103
- <% - toPascalCase(collection.name) %> that = (<% - toPascalCase(collection.name) %> ) obj;
104
- return <% collection.attributes.forEach((attr , index) => { %> Objects.equals(<%= toCamelCase(attr .key) %> , that.<%= toCamelCase(attr .key) %> )<% if (index < collection.attributes.length - 1 ) { %> &&
99
+ @Override
100
+ public boolean equals(Object obj) {
101
+ if (this == obj) return true;
102
+ if (obj == null || getClass() != obj.getClass()) return false;
103
+ <% - toPascalCase(collection.name) %> that = (<% - toPascalCase(collection.name) %> ) obj;
104
+ return <% collection.attributes.forEach((attr , index) => { %> Objects.equals(<%= toCamelCase(attr .key) %> , that.<%= toCamelCase(attr .key) %> )<% if (index < collection.attributes.length - 1 ) { %> &&
105
105
<% } }); %> ;
106
- }
106
+ }
107
107
108
- @Override
109
- public int hashCode() {
110
- return Objects.hash(<%= collection.attributes.map(attr => toCamelCase(attr .key)).join(' , ' ) %> );
111
- }
108
+ @Override
109
+ public int hashCode() {
110
+ return Objects.hash(<%= collection.attributes.map(attr => toCamelCase(attr .key)).join(' , ' ) %> );
111
+ }
112
112
113
- @Override
114
- public String toString() {
115
- return "<% - toPascalCase(collection.name) %> {" +
116
- <% for (const attribute of collection.attributes) { -%>
117
- "<%= strict ? toCamelCase(attribute.key) : attribute.key %> =" + <%= strict ? toCamelCase(attribute.key) : attribute.key %> +
113
+ @Override
114
+ public String toString() {
115
+ return "<% - toPascalCase(collection.name) %> {" +
116
+ <% for (const [index, attribute] of Object .entries( collection.attributes) ) { -%>
117
+ "<%= strict ? toCamelCase(attribute.key) : attribute.key %> =" + <%= strict ? toCamelCase(attribute.key) : attribute.key %> +<% if (index < collection.attributes.length - 1 ) { %> ", " + <% } %>
118
118
<% } -%>
119
- '}';
120
- }
119
+ '}';
120
+ }
121
121
}
122
122
`;
123
123
}
0 commit comments