io.alauda.kubernetes.api.model.PipelineConfigSpecBuilder 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 PipelineConfigSpecBuilder extends PipelineConfigSpecFluentImpl implements VisitableBuilder{
PipelineConfigSpecFluent> fluent;
Boolean validationEnabled;
public PipelineConfigSpecBuilder(){
this(true);
}
public PipelineConfigSpecBuilder(Boolean validationEnabled){
this(new PipelineConfigSpec(), validationEnabled);
}
public PipelineConfigSpecBuilder(PipelineConfigSpecFluent> fluent){
this(fluent, true);
}
public PipelineConfigSpecBuilder(PipelineConfigSpecFluent> fluent,Boolean validationEnabled){
this(fluent, new PipelineConfigSpec(), validationEnabled);
}
public PipelineConfigSpecBuilder(PipelineConfigSpecFluent> fluent,PipelineConfigSpec instance){
this(fluent, instance, true);
}
public PipelineConfigSpecBuilder(PipelineConfigSpecFluent> fluent,PipelineConfigSpec instance,Boolean validationEnabled){
this.fluent = fluent;
fluent.withHooks(instance.getHooks());
fluent.withJenkinsBinding(instance.getJenkinsBinding());
fluent.withParameters(instance.getParameters());
fluent.withRunLimits(instance.getRunLimits());
fluent.withRunPolicy(instance.getRunPolicy());
fluent.withSource(instance.getSource());
fluent.withStrategy(instance.getStrategy());
fluent.withTriggers(instance.getTriggers());
this.validationEnabled = validationEnabled;
}
public PipelineConfigSpecBuilder(PipelineConfigSpec instance){
this(instance,true);
}
public PipelineConfigSpecBuilder(PipelineConfigSpec instance,Boolean validationEnabled){
this.fluent = this;
this.withHooks(instance.getHooks());
this.withJenkinsBinding(instance.getJenkinsBinding());
this.withParameters(instance.getParameters());
this.withRunLimits(instance.getRunLimits());
this.withRunPolicy(instance.getRunPolicy());
this.withSource(instance.getSource());
this.withStrategy(instance.getStrategy());
this.withTriggers(instance.getTriggers());
this.validationEnabled = validationEnabled;
}
public PipelineConfigSpec build(){
PipelineConfigSpec buildable = new PipelineConfigSpec(fluent.getHooks(),fluent.getJenkinsBinding(),fluent.getParameters(),fluent.getRunLimits(),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;
PipelineConfigSpecBuilder that = (PipelineConfigSpecBuilder) 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;
}
}