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

JavaJaxRS.model.mustache Maven / Gradle / Ivy

The newest version!
package {{package}};

{{#imports}}import {{import}};
{{/imports}}

import com.wordnik.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
{{#models}}

{{#model}}{{#description}}
/**
 * {{description}}
 **/{{/description}}
@ApiModel(description = "{{{description}}}")
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
  {{#vars}}{{#isEnum}}
  public enum {{datatypeWithEnum}} {
    {{#allowableValues}}{{#values}} {{.}}, {{/values}}{{/allowableValues}}
  };
  private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/isEnum}}{{^isEnum}}
  private {{{datatype}}} {{name}} = {{{defaultValue}}};{{/isEnum}}{{/vars}}

  {{#vars}}
  /**{{#description}}
   * {{{description}}}{{/description}}{{#minimum}}
   * minimum: {{minimum}}{{/minimum}}{{#maximum}}
   * maximum: {{maximum}}{{/maximum}}
   **/
  @ApiModelProperty(required = {{required}}, value = "{{{description}}}")
  @JsonProperty("{{name}}")
  public {{{datatypeWithEnum}}} {{getter}}() {
    return {{name}};
  }
  public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
    this.{{name}} = {{name}};
  }

  {{/vars}}

  @Override
  public String toString()  {
    StringBuilder sb = new StringBuilder();
    sb.append("class {{classname}} {\n");
    {{#parent}}sb.append("  " + super.toString()).append("\n");{{/parent}}
    {{#vars}}sb.append("  {{name}}: ").append({{name}}).append("\n");
    {{/vars}}sb.append("}\n");
    return sb.toString();
  }
}
{{/model}}
{{/models}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy