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

JavaClient.pojo.mustache Maven / Gradle / Ivy

Go to download

This artefact generates other artefacts such as API client, API server out of API Model

There is a newer version: 1.1.1
Show newest version
{{#description}}/**
 * {{.}}
 */{{/description}}
public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{
{{#_enums}}

{{>modelInnerEnum}}
{{/_enums}}

  {{#nonInheritedVars}}
  {{#isContainer}}
    private {{{datatypeWithEnum}}} {{name}};
  {{/isContainer}}
  {{^isContainer}}
    private {{^isMeta}}{{{datatypeWithEnum}}}{{/isMeta}}{{#isMeta}}Object{{/isMeta}} {{name}}{{#isDefaultValueVisible}} = {{{defaultValue}}}{{/isDefaultValueVisible}};
  {{/isContainer}}

  {{/nonInheritedVars}}
  {{#nonInheritedVars}}
    /**
  {{#description}}
     * {{description}}
  {{/description}}
  {{^description}}
     * Get {{name}}
  {{/description}}
  {{#minimum}}
     * minimum: {{minimum}}
  {{/minimum}}
  {{#maximum}}
     * maximum: {{maximum}}
  {{/maximum}}
     * @return {{name}}
     */
{{#vendorExtensions.extraAnnotation}}
  {{{vendorExtensions.extraAnnotation}}}
{{/vendorExtensions.extraAnnotation}}
    public {{^isMeta}}{{{datatypeWithEnum}}}{{/isMeta}}{{#isMeta}}Object{{/isMeta}} {{getter}}() {
        return {{name}};
    }
  {{^isReadOnly}}

    public void {{setter}}({{^isMeta}}{{{datatypeWithEnum}}}{{/isMeta}}{{#isMeta}}Object{{/isMeta}} {{name}}) {
        this.{{name}} = {{name}};
    }
  {{/isReadOnly}}

  {{/nonInheritedVars}}
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }{{#hasVars}}
        {{classname}} {{classVarName}} = ({{classname}}) o;
        return {{#nonInheritedVars}}{{#isByteArray}}Arrays{{/isByteArray}}{{#isBinary}}Arrays{{/isBinary}}{{^isByteArray}}{{^isBinary}}Objects{{/isBinary}}{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} &&
            {{/-last}}{{/nonInheritedVars}}{{#parent}} &&
            super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
        return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
    }

    @Override
    public int hashCode() {
        return Objects.hash({{#nonInheritedVars}}
            {{^isByteArray}}{{^isBinary}}{{name}}{{/isBinary}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{#isBinary}}Arrays.hashCode({{name}}){{/isBinary}}{{^-last}},{{/-last}}{{/nonInheritedVars}}{{#parent}}{{#hasVars}},
            {{/hasVars}}super.hashCode(){{/parent}});
    }

    @Override
    public String toString() {
        return "class {{classname}} {\n" +{{#vars}}
            "   {{name}}: " + toIndentedString({{^isInherited}}{{name}}{{/isInherited}}{{#isInherited}}{{getter}}(){{/isInherited}}) + "\n" + {{/vars}}
            "}";
    }{{#hasVars}}

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }{{/hasVars}}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy