way-auto-optional.PojoBuilderPojo.mustache Maven / Gradle / Ivy
package {{superClass.package.name}};
{{#imports}}
import {{qualifiedName}};
{{/imports}}
@javax.annotation.Generated("br.com.objectos.way.auto.optional.AutoOptionalProcessor")
final class {{superClass.name}}BuilderPojo
implements
{{superClass.name}}Builder,
{{#methods}}
{{^last}}
{{superClass.name}}Builder.{{superClass.name}}Builder{{fieldToClassName}},
{{/last}}
{{#last}}
{{superClass.name}}Builder.{{superClass.name}}Builder{{fieldToClassName}} {
{{/last}}
{{/methods}}
{{#constructors}}
{{#parameters}}
{{#parameter}}
private final {{declaration}};
{{/parameter}}
{{/parameters}}
{{/constructors}}
{{#methods}}
private {{{unboxedType.name}}} {{fieldName}};
{{/methods}}
{{#constructors}}
public {{superClass.name}}BuilderPojo({{#parameters}}{{{parameter.declaration}}}{{^last}}, {{/last}}{{/parameters}}) {
{{#parameters}}
{{#parameter}}
{{^type.primitive}}
if ({{name}} == null) {
throw new NullPointerException();
}
{{/type.primitive}}
this.{{name}} = {{name}};
{{/parameter}}
{{/parameters}}
}
{{/constructors}}
@Override
public {{superClass.name}} build() {
return new {{superClass.name}}Pojo(this);
}
{{#methods}}
@Override
public {{superClass.name}}Builder{{fieldToClassName}} {{fieldName}}({{{unboxedType.name}}} {{fieldName}}) {
{{^returnType.primitive}}
if ({{fieldName}} == null) {
throw new NullPointerException();
}
{{/returnType.primitive}}
this.{{fieldName}} = {{fieldName}};
return this;
}
{{#constructors}}
{{#parameters}}
{{#parameter}}
{{{type.name}}} {{name}}() {
return {{name}};
}
{{^last}}
{{/last}}
{{/parameter}}
{{/parameters}}
{{/constructors}}
{{/methods}}
{{#methods}}
{{{returnType.name}}} {{name}}() {
{{returnFieldName}};
}
{{/methods}}
}