@@ -50,7 +50,7 @@ class Java extends LanguageMeta {
5050 * You can regenerate it by running \`appwrite types -l java ${this.getCurrentDirectory()}\`.
5151 */
5252
53- import java.util.* ;
53+ import java.util.Objects ;
5454<% for (const attribute of collection.attributes) { -%>
5555<% if (attribute.type === ' relationship' ) { -%>
5656import io.appwrite.models.<% - toPascalCase(attribute.relatedCollection) %> ;
@@ -61,63 +61,63 @@ public class <%- toPascalCase(collection.name) %> {
6161<% for (const attribute of collection.attributes) { -%>
6262<% if (attribute.format === ' enum' ) { -%>
6363
64- public enum <% - toPascalCase(attribute.key) %> {
64+ public enum <% - toPascalCase(attribute.key) %> {
6565<% 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 ? ' ,' : ' ;' %>
6767<% } -%>
68- }
68+ }
6969
7070<% } -%>
7171<% } -%>
7272<% 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 %> ;
7474<% } -%>
7575
76- public <% - toPascalCase(collection.name) %> () {
77- }
76+ public <% - toPascalCase(collection.name) %> () {
77+ }
7878
79- public <% - toPascalCase(collection.name) %> (
79+ public <% - toPascalCase(collection.name) %> (
8080<% 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 ? ' ,' : ' ' %>
8282<% } -%>
83- ) {
83+ ) {
8484<% 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 %> ;
8686<% } -%>
87- }
87+ }
8888
8989<% 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+ }
9393
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+ }
9797
9898<% } -%>
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 ) { %> &&
105105 <% } }); %> ;
106- }
106+ }
107107
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+ }
112112
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 ) { %> ", " + <% } %>
118118<% } -%>
119- '}';
120- }
119+ '}';
120+ }
121121}
122122`;
123123 }
0 commit comments