![JAR search and dependency download from the Maven repository](/logo.png)
templates.java.class.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
{{>header}}{{#packageName}}package {{&packageName}};
{{/packageName}}{{#constraints}}{{>system_imports}}{{#imports}}import {{&.}};
{{#last}}
{{/last}}{{/imports}}{{#schema}}{{#description}}/**
* {{&safeDescription}}
*/
{{/description}}{{/schema}}{{>annotations}}public class {{&className}}{{>extends_implements}} {
{{>add_statics}}
{{#nonBaseProperties}} private final {{>type}} {{&javaName}};
{{#last}}
{{/last}}{{/nonBaseProperties}}{{#numberOfProperties}}{{! TODO java.beans.ConstructorProperties ? }} public {{&className}}({{#properties}}{{^first}},{{/first}}
{{>type}} {{&javaName}}{{/properties}}
) {
{{#baseClass}}{{#constraints}} super({{#properties}}{{#extendedInDerived}}cg_valid_{{&javaName}}({{&javaName}}){{/extendedInDerived}}{{!
}}{{^extendedInDerived}}{{&javaName}}{{/extendedInDerived}}{{^last}}, {{/last}}{{/properties}});
{{/constraints}}{{/baseClass}}{{#properties}}{{^baseProperty}}{{^isPrimitive}}{{^nullable}} if ({{&javaName}} == null)
{{>tniae}}("Must not be null - {{&javaName}}");
{{/nullable}}{{/isPrimitive}}{{/baseProperty}}{{^baseProperty.extendedInDerived}}{{>validations}}{{/baseProperty.extendedInDerived}}{{^baseProperty}} this.{{&javaName}} = {{&javaName}};
{{/baseProperty}}{{/properties}} }
{{#properties}}{{#extendedFromBase}}
private static {{>type}} cg_valid_{{&javaName}}({{>type}} {{&javaName}}) {
{{^isPrimitive}}{{^nullable}} if ({{&javaName}} == null)
{{>tniae}}("Must not be null - {{&javaName}}");
{{/nullable}}{{/isPrimitive}}{{>validations}} return {{&javaName}};
}
{{/extendedFromBase}}{{/properties}}
{{/numberOfProperties}}{{>getters}}{{>equals}}
{{>hashcode}}
{{>builder}}{{#nestedClasses}}
{{#constraints}}{{#indent.increment}}{{>nested_class}}{{/indent.increment}}{{/constraints}}{{/nestedClasses}}
}{{/constraints}}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy