io.sundr.examples.arrays.PersonBuilder Maven / Gradle / Ivy
package io.sundr.examples.arrays;
import io.sundr.builder.VisitableBuilder;
import java.lang.Object;
import java.lang.Boolean;
public class PersonBuilder extends PersonFluentImpl implements VisitableBuilder{
PersonFluent> fluent;
Boolean validationEnabled;
public PersonBuilder(){
this(true);
}
public PersonBuilder(Boolean validationEnabled){
this.fluent = this; this.validationEnabled=validationEnabled;
}
public PersonBuilder(PersonFluent> fluent){
this(fluent, true);
}
public PersonBuilder(PersonFluent> fluent,Boolean validationEnabled){
this.fluent = fluent; this.validationEnabled=validationEnabled;
}
public PersonBuilder(PersonFluent> fluent,Person instance){
this(fluent, instance, true);
}
public PersonBuilder(PersonFluent> fluent,Person instance,Boolean validationEnabled){
this.fluent = fluent;
fluent.withFirstName(instance.getFirstName());
fluent.withLastName(instance.getLastName());
fluent.withNumbers(instance.getNumbers());
this.validationEnabled = validationEnabled;
}
public PersonBuilder(Person instance){
this(instance,true);
}
public PersonBuilder(Person instance,Boolean validationEnabled){
this.fluent = this;
this.withFirstName(instance.getFirstName());
this.withLastName(instance.getLastName());
this.withNumbers(instance.getNumbers());
this.validationEnabled = validationEnabled;
}
public io.sundr.examples.arrays.EditablePerson build(){
EditablePerson buildable = new EditablePerson(fluent.getFirstName(),fluent.getLastName(),fluent.getNumbers());
return buildable;
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
PersonBuilder that = (PersonBuilder) o;
if (fluent != null &&fluent != this ? !fluent.equals(that.fluent) :that.fluent != null &&fluent != this ) return false;
if (validationEnabled != null ? !validationEnabled.equals(that.validationEnabled) :that.validationEnabled != null) return false;
return true;
}
}