All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.java.class.mustache Maven / Gradle / Ivy

There is a newer version: 0.113
Show newest version
{{>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