![JAR search and dependency download from the Maven repository](/logo.png)
templates.java.equals.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-kotlin-schema-codegen Show documentation
Show all versions of json-kotlin-schema-codegen Show documentation
Code generation from JSON Schema to Kotlin or Java
{{&indent}} @Override
{{&indent}} public boolean equals(Object cg_other) {
{{&indent}} if (this == cg_other)
{{&indent}} return true;
{{&indent}} if (!(cg_other instanceof {{&className}}))
{{&indent}} return false;
{{#hasBaseClassWithProperties}}{{&indent}} if (!super.equals(cg_other))
{{&indent}} return false;
{{/hasBaseClassWithProperties}}{{#nonBaseProperties}}{{#first}}{{&indent}} {{&className}} cg_typedOther = ({{&className}})cg_other;
{{/first}}{{#last}}{{#isPrimitive}}{{&indent}} return {{&javaName}} == cg_typedOther.{{&javaName}};
{{/isPrimitive}}{{^isPrimitive}}{{#isEnumClass}}{{&indent}} return {{&javaName}} == cg_typedOther.{{&javaName}};
{{/isEnumClass}}{{^isEnumClass}}{{#nullable}}{{&indent}} return {{&javaName}} == null ? cg_typedOther.{{&javaName}} == null : {{&javaName}}.equals(cg_typedOther.{{&javaName}});
{{/nullable}}{{^nullable}}{{&indent}} return {{&javaName}}.equals(cg_typedOther.{{&javaName}});
{{/nullable}}{{/isEnumClass}}{{/isPrimitive}}{{/last}}{{^last}}{{#isPrimitive}}{{&indent}} if ({{&javaName}} != cg_typedOther.{{&javaName}})
{{/isPrimitive}}{{^isPrimitive}}{{#isEnumClass}}{{&indent}} if ({{&javaName}} != cg_typedOther.{{&javaName}})
{{/isEnumClass}}{{^isEnumClass}}{{#nullable}}{{&indent}} if ({{&javaName}} == null ? cg_typedOther.{{&javaName}} != null : !{{&javaName}}.equals(cg_typedOther.{{&javaName}}))
{{/nullable}}{{^nullable}}{{&indent}} if (!{{&javaName}}.equals(cg_typedOther.{{&javaName}}))
{{/nullable}}{{/isEnumClass}}{{/isPrimitive}}{{! TODO check if property is array (do we ever use array?) and if so emit "Arrays.equals"
}}{{&indent}} return false;
{{/last}}{{/nonBaseProperties}}{{^nonBaseProperties}}{{&indent}} return true;
{{/nonBaseProperties}}{{&indent}} }
© 2015 - 2025 Weber Informatics LLC | Privacy Policy