openapi-generator.mustache-templates.pojoBuilder.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-generator Show documentation
Show all versions of openapi-generator Show documentation
OpenAPI Services data model (VDM) - generator classes
{{#pojoBuilderMethodName}}
{{#hasRequired}}
/**
* Create a type-safe, fluent-api builder object to construct a new {@link {{classname}}} instance with all required arguments.
*/
public static Builder {{pojoBuilderMethodName}}() {
return {{#requiredVars}}({{name}}) -> {{/requiredVars}}{{#pojoBuildMethodName}}() -> {{/pojoBuildMethodName}}new {{classname}}(){{#requiredVars}}.{{name}}({{name}}){{/requiredVars}};
}
/**
* Builder helper class.
*/
public interface Builder {
{{#requiredVars}}
/**
* Set the {{name}} of this {@link {{classname}}} instance.
*
* @param {{name}} {{#description}}{{description}}{{/description}}{{^description}}The {{name}} of this {@link {{classname}}}{{/description}}
* @return {{^-last}}The {{classname}} builder.{{/-last}}{{#-last}}The {{classname}} instance.{{/-last}}
*/
{{^pojoBuildMethodName}}{{^-last}}Builder{{-index}}{{/-last}}{{#-last}}{{classname}}{{/-last}}{{/pojoBuildMethodName}}{{#pojoBuildMethodName}}Builder{{-index}}{{/pojoBuildMethodName}} {{name}}( {{#isNullable}}@Nullable{{/isNullable}}{{^isNullable}}@Nonnull{{/isNullable}} final {{{datatypeWithEnum}}} {{name}});
{{#isArray}}
/**
* Set the {{name}} of this {@link {{classname}}} instance.
*
* @param {{name}} {{#description}}{{description}}{{/description}}{{^description}}The {{name}} of this {@link {{classname}}}{{/description}}
* @return {{^-last}}The {{classname}} builder.{{/-last}}{{#-last}}The {{classname}} instance.{{/-last}}
*/
default {{^pojoBuildMethodName}}{{^-last}}Builder{{-index}}{{/-last}}{{#-last}}{{classname}}{{/-last}}{{/pojoBuildMethodName}}{{#pojoBuildMethodName}}Builder{{-index}}{{/pojoBuildMethodName}} {{name}}( @Nonnull final {{{items.datatypeWithEnum}}}... {{name}}) {
return {{name}}(Arrays.asList({{name}}));
}
{{/isArray}}
}
{{^-last}}
/**
* Builder helper class.
*/
public interface Builder{{-index}} {
{{/-last}}
{{#-last}}
{{#pojoBuildMethodName}}
/**
* Builder helper class.
*/
public interface Builder{{-index}} {
/**
* Finalize the builder for new {@link {{classname}}} instance.
*
* @return The {{classname}} instance.
*/
{{classname}} {{pojoBuildMethodName}}();
}
{{/pojoBuildMethodName}}
{{/-last}}
{{/requiredVars}}
{{/hasRequired}}
{{^hasRequired}}
/**
* Create a new {@link {{classname}}} instance. No arguments are required.
*/
public static {{classname}} {{pojoBuilderMethodName}}() {
return new {{classname}}();
}
{{/hasRequired}}
{{/pojoBuilderMethodName}}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy