io.alauda.kubernetes.api.model.PipelineSpecBuilder 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 PipelineSpecBuilder extends PipelineSpecFluentImpl implements VisitableBuilder{
PipelineSpecFluent> fluent;
Boolean validationEnabled;
public PipelineSpecBuilder(){
this(true);
}
public PipelineSpecBuilder(Boolean validationEnabled){
this(new PipelineSpec(), validationEnabled);
}
public PipelineSpecBuilder(PipelineSpecFluent> fluent){
this(fluent, true);
}
public PipelineSpecBuilder(PipelineSpecFluent> fluent,Boolean validationEnabled){
this(fluent, new PipelineSpec(), validationEnabled);
}
public PipelineSpecBuilder(PipelineSpecFluent> fluent,PipelineSpec instance){
this(fluent, instance, true);
}
public PipelineSpecBuilder(PipelineSpecFluent> fluent,PipelineSpec instance,Boolean validationEnabled){
this.fluent = fluent;
fluent.withCause(instance.getCause());
fluent.withHooks(instance.getHooks());
fluent.withJenkinsBinding(instance.getJenkinsBinding());
fluent.withParameters(instance.getParameters());
fluent.withPipelineConfig(instance.getPipelineConfig());
fluent.withRunPolicy(instance.getRunPolicy());
fluent.withSource(instance.getSource());
fluent.withStrategy(instance.getStrategy());
fluent.withTriggers(instance.getTriggers());
this.validationEnabled = validationEnabled;
}
public PipelineSpecBuilder(PipelineSpec instance){
this(instance,true);
}
public PipelineSpecBuilder(PipelineSpec instance,Boolean validationEnabled){
this.fluent = this;
this.withCause(instance.getCause());
this.withHooks(instance.getHooks());
this.withJenkinsBinding(instance.getJenkinsBinding());
this.withParameters(instance.getParameters());
this.withPipelineConfig(instance.getPipelineConfig());
this.withRunPolicy(instance.getRunPolicy());
this.withSource(instance.getSource());
this.withStrategy(instance.getStrategy());
this.withTriggers(instance.getTriggers());
this.validationEnabled = validationEnabled;
}
public PipelineSpec build(){
PipelineSpec buildable = new PipelineSpec(fluent.getCause(),fluent.getHooks(),fluent.getJenkinsBinding(),fluent.getParameters(),fluent.getPipelineConfig(),fluent.getRunPolicy(),fluent.getSource(),fluent.getStrategy(),fluent.getTriggers());
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;
PipelineSpecBuilder that = (PipelineSpecBuilder) 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;
}
}