io.alauda.kubernetes.api.model.PipelineTemplateSpecBuilder Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model;
import io.alauda.kubernetes.api.builder.VisitableBuilder;
import java.lang.Object;
import java.lang.Boolean;
public class PipelineTemplateSpecBuilder extends PipelineTemplateSpecFluentImpl implements VisitableBuilder{
PipelineTemplateSpecFluent> fluent;
Boolean validationEnabled;
public PipelineTemplateSpecBuilder(){
this(true);
}
public PipelineTemplateSpecBuilder(Boolean validationEnabled){
this(new PipelineTemplateSpec(), validationEnabled);
}
public PipelineTemplateSpecBuilder(PipelineTemplateSpecFluent> fluent){
this(fluent, true);
}
public PipelineTemplateSpecBuilder(PipelineTemplateSpecFluent> fluent,Boolean validationEnabled){
this(fluent, new PipelineTemplateSpec(), validationEnabled);
}
public PipelineTemplateSpecBuilder(PipelineTemplateSpecFluent> fluent,PipelineTemplateSpec instance){
this(fluent, instance, true);
}
public PipelineTemplateSpecBuilder(PipelineTemplateSpecFluent> fluent,PipelineTemplateSpec instance,Boolean validationEnabled){
this.fluent = fluent;
fluent.withAgent(instance.getAgent());
fluent.withArguments(instance.getArguments());
fluent.withEngine(instance.getEngine());
fluent.withEnvironments(instance.getEnvironments());
fluent.withParameters(instance.getParameters());
fluent.withStages(instance.getStages());
fluent.withWithSCM(instance.getWithSCM());
this.validationEnabled = validationEnabled;
}
public PipelineTemplateSpecBuilder(PipelineTemplateSpec instance){
this(instance,true);
}
public PipelineTemplateSpecBuilder(PipelineTemplateSpec instance,Boolean validationEnabled){
this.fluent = this;
this.withAgent(instance.getAgent());
this.withArguments(instance.getArguments());
this.withEngine(instance.getEngine());
this.withEnvironments(instance.getEnvironments());
this.withParameters(instance.getParameters());
this.withStages(instance.getStages());
this.withWithSCM(instance.getWithSCM());
this.validationEnabled = validationEnabled;
}
public PipelineTemplateSpec build(){
PipelineTemplateSpec buildable = new PipelineTemplateSpec(fluent.getAgent(),fluent.getArguments(),fluent.getEngine(),fluent.getEnvironments(),fluent.getParameters(),fluent.getStages(),fluent.isWithSCM());
io.alauda.kubernetes.api.builder.ValidationUtils.validate(buildable);
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;
PipelineTemplateSpecBuilder that = (PipelineTemplateSpecBuilder) 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;
}
}