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

java-micronaut.common.model.jackson_annotations.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
{{!
 If this is map and items are nullable, make sure that nulls are included.
 To determine what JsonInclude.Include method to use, consider the following:
 * If the field is required, always include it, even if it is null.
 * Else use custom behaviour, IOW use whatever is defined on the object mapper
 }}
    @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}})
    @JsonInclude({{#isMap}}{{#items.isNullable}}content = JsonInclude.Include.ALWAYS, {{/items.isNullable}}{{/isMap}}value = JsonInclude.Include.{{#required}}ALWAYS{{/required}}{{^required}}USE_DEFAULTS{{/required}})
    {{#withXml}}
        {{^isContainer}}
    @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
    @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
        {{/isContainer}}
        {{#isContainer}}
            {{#isXmlWrapped}}
    // items.xmlName={{items.xmlName}}
    @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}")
            {{/isXmlWrapped}}
        {{/isContainer}}
    {{/withXml}}
    {{#jackson}}
        {{#isDateTime}}
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "{{{datetimeFormat}}}")
        {{/isDateTime}}
        {{#isDate}}
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "{{{dateFormat}}}")
        {{/isDate}}
    {{/jackson}}
    {{#micronaut_serde_jackson}}
        {{#isDateTime}}
    @JsonFormat(pattern = "{{{datetimeFormat}}}")
        {{/isDateTime}}
        {{#isDate}}
    @JsonFormat(pattern = "{{{dateFormat}}}")
        {{/isDate}}
    {{/micronaut_serde_jackson}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy