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

templates.kotlin-micronaut.common.model.pojo.mustache Maven / Gradle / Ivy


{{#formatNoEmptyLines}}
/**
 * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
{{#isDeprecated}}
 *
 * @deprecated{{#vendorExtensions.x-deprecated-message}} {{{.}}}{{/vendorExtensions.x-deprecated-message}}
{{/isDeprecated}}
 */
{{#isDeprecated}}
@Deprecated("{{#vendorExtensions.x-deprecated-message}}{{{.}}}{{/vendorExtensions.x-deprecated-message}}")
{{/isDeprecated}}
{{#description}}
    {{#generateSwagger2Annotations}}
@Schema({{#vendorExtensions.realName}}name = "{{{vendorExtensions.realName}}}", {{/vendorExtensions.realName}}description = "{{{description}}}"{{#isDeprecated}}, deprecated = true{{/isDeprecated}})
    {{/generateSwagger2Annotations}}
{{/description}}
{{#micronaut_serde_jackson}}
@Serdeable
{{/micronaut_serde_jackson}}
{{#jackson}}
    {{#vendorExtensions.hasOwnVars}}
@JsonPropertyOrder(
    {{#vars}}
    {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}},
    {{/vars}}
)
    {{/vendorExtensions.hasOwnVars}}
{{/jackson}}
{{#additionalModelTypeAnnotations}}
{{{.}}}
{{/additionalModelTypeAnnotations}}
{{#generatedAnnotation}}
{{>common/generatedAnnotation}}
{{/generatedAnnotation}}
{{>common/model/typeInfoAnnotation}}
{{>common/model/xmlAnnotation}}
{{#useBeanValidation}}
    {{^micronaut_serde_jackson}}
@Introspected
    {{/micronaut_serde_jackson}}
{{/useBeanValidation}}
{{#vendorExtensions.x-class-extra-annotation}}
{{{.}}}
{{/vendorExtensions.x-class-extra-annotation}}
{{/formatNoEmptyLines}}
{{!Declare the class with extends and implements}}
{{#nonPublicApi}}internal {{/nonPublicApi}}{{#hasChildren}}open {{/hasChildren}}{{^hasChildren}}{{#hasVars}}data {{/hasVars}}{{/hasChildren}}class {{classname}}{{#hasVars}}({{/hasVars}}
{{#vendorExtensions.requiredVarsWithoutDiscriminator}}

    {{#formatNoEmptyLines}}
    {{#description}}
    /**
     * {{description}}
        {{#deprecated}}
     *
     * @deprecated{{#vendorExtensions.x-deprecated-message}} {{{.}}}{{/vendorExtensions.x-deprecated-message}}
        {{/deprecated}}
     */
    {{/description}}
    {{^description}}
        {{#deprecated}}
    /**
     * @deprecated{{#vendorExtensions.x-deprecated-message}} {{{.}}}{{/vendorExtensions.x-deprecated-message}}
     */
        {{/deprecated}}
    {{/description}}
    {{>common/model/field_annotations}}
    {{#vendorExtensions.overridden}}override {{/vendorExtensions.overridden}}{{^vendorExtensions.overridden}}{{#hasChildren}}open {{/hasChildren}}{{/vendorExtensions.overridden}}var {{{name}}}: {{{vendorExtensions.typeWithEnumWithGenericAnnotations}}}{{#vendorExtensions.defaultValueInit}} = {{{.}}}{{/vendorExtensions.defaultValueInit}}{{^vendorExtensions.defaultValueInit}}{{#isNullable}} = null{{/isNullable}}{{/vendorExtensions.defaultValueInit}},
    {{/formatNoEmptyLines}}
{{/vendorExtensions.requiredVarsWithoutDiscriminator}}
{{#vendorExtensions.withInheritance}}
    {{#vendorExtensions.optionalVars}}

        {{#formatNoEmptyLines}}
        {{#description}}
    /**
     * {{description}}
    {{#deprecated}}
     *
     * @deprecated{{#vendorExtensions.x-deprecated-message}} {{{.}}}{{/vendorExtensions.x-deprecated-message}}
    {{/deprecated}}
     */
        {{/description}}
        {{^description}}
            {{#deprecated}}
    /**
     * @deprecated{{#vendorExtensions.x-deprecated-message}} {{{.}}}{{/vendorExtensions.x-deprecated-message}}
     */
            {{/deprecated}}
        {{/description}}
    {{>common/model/field_annotations}}
    {{#vendorExtensions.overridden}}override {{/vendorExtensions.overridden}}{{^vendorExtensions.overridden}}{{#vendorExtensions.hasChildren}}open {{/vendorExtensions.hasChildren}}{{/vendorExtensions.overridden}}var {{{name}}}: {{{vendorExtensions.typeWithEnumWithGenericAnnotations}}} = {{#vendorExtensions.defaultValueInit}}{{{.}}}{{/vendorExtensions.defaultValueInit}}{{^vendorExtensions.defaultValueInit}}null{{/vendorExtensions.defaultValueInit}},
    {{/formatNoEmptyLines}}
    {{/vendorExtensions.optionalVars}}
{{/vendorExtensions.withInheritance}}
{{#hasVars}}){{/hasVars}}{{#parent}} : {{{parent}}}({{#vendorExtensions.requiredParentVarsWithoutDiscriminator}}{{{name}}}{{^-last}}, {{/-last}}{{/vendorExtensions.requiredParentVarsWithoutDiscriminator}}){{/parent}}{{#vendorExtensions.x-implements}}{{#parent}}, {{/parent}}{{^parent}}: {{/parent}}{{^-first}}, {{/-first}}{{{.}}}{{/vendorExtensions.x-implements}} {{openbrace}}

    {{#vendorExtensions.withInheritance}}

    override fun equals(other: Any?): Boolean {
        if (this === other) {
            return true
        }
        if (javaClass != other?.javaClass) {
            return false
        }
        other as {{classname}}
    {{#vendorExtensions.hasOwnVars}}
        return {{#vars}}{{^-first}}
                && {{/-first}}{{{name}}} == other.{{{name}}}{{/vars}}{{#parent}}
                && super.equals(other){{/parent}}
    {{/vendorExtensions.hasOwnVars}}
    {{^vendorExtensions.hasOwnVars}}
        return {{#parent}}super.equals(other){{/parent}}{{^parent}}true{{/parent}}
    {{/vendorExtensions.hasOwnVars}}
    }

    override fun hashCode(): Int =
        Objects.hash({{#vars}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#vendorExtensions.hasOwnVars}}, {{/vendorExtensions.hasOwnVars}}super.hashCode(){{/parent}})

    override fun toString(): String =
    {{#hasVars}}
        "{{classname}}({{#allVars}}{{{vendorExtensions.realName}}}='${{{name}}}'{{^-last}}, {{/-last}}{{/allVars}})"
    {{/hasVars}}
    {{^hasVars}}
        "{{classname}}()"
    {{/hasVars}}
    {{/vendorExtensions.withInheritance}}

    {{#vars}}
        {{#isEnum}}
            {{^isContainer}}
                {{#indent}}
{{>common/model/enum}}
                {{/indent}}
            {{/isContainer}}
            {{#isContainer}}
                {{#mostInnerItems}}
                    {{#indent}}
{{>common/model/enum}}
                    {{/indent}}
                {{/mostInnerItems}}
            {{/isContainer}}
        {{/isEnum}}

    {{/vars}}

    {{#vendorExtensions.hasOwnVars}}
    companion object {
    {{#serializableModel}}

        @Serial
        @JvmStatic
        private val serialVersionUID = {{{vendorExtensions.serialId}}}L
    {{/serializableModel}}

    {{#vars}}
        const val JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"
    {{/vars}}
    }
    {{/vendorExtensions.hasOwnVars}}
    {{^vendorExtensions.hasOwnVars}}
        {{#serializableModel}}
    companion object {

        @Serial
        @JvmStatic
        private val serialVersionUID = {{{vendorExtensions.serialId}}}L
    }
        {{/serializableModel}}
    {{/vendorExtensions.hasOwnVars}}
{{closebrace}}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy