io.alauda.kubernetes.api.model.NodeSpecBuilder 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 NodeSpecBuilder extends NodeSpecFluentImpl implements VisitableBuilder{
NodeSpecFluent> fluent;
Boolean validationEnabled;
public NodeSpecBuilder(){
this(true);
}
public NodeSpecBuilder(Boolean validationEnabled){
this(new NodeSpec(), validationEnabled);
}
public NodeSpecBuilder(NodeSpecFluent> fluent){
this(fluent, true);
}
public NodeSpecBuilder(NodeSpecFluent> fluent,Boolean validationEnabled){
this(fluent, new NodeSpec(), validationEnabled);
}
public NodeSpecBuilder(NodeSpecFluent> fluent,NodeSpec instance){
this(fluent, instance, true);
}
public NodeSpecBuilder(NodeSpecFluent> fluent,NodeSpec instance,Boolean validationEnabled){
this.fluent = fluent;
fluent.withExternalID(instance.getExternalID());
fluent.withPodCIDR(instance.getPodCIDR());
fluent.withProviderID(instance.getProviderID());
fluent.withTaints(instance.getTaints());
fluent.withUnschedulable(instance.getUnschedulable());
this.validationEnabled = validationEnabled;
}
public NodeSpecBuilder(NodeSpec instance){
this(instance,true);
}
public NodeSpecBuilder(NodeSpec instance,Boolean validationEnabled){
this.fluent = this;
this.withExternalID(instance.getExternalID());
this.withPodCIDR(instance.getPodCIDR());
this.withProviderID(instance.getProviderID());
this.withTaints(instance.getTaints());
this.withUnschedulable(instance.getUnschedulable());
this.validationEnabled = validationEnabled;
}
public NodeSpec build(){
NodeSpec buildable = new NodeSpec(fluent.getExternalID(),fluent.getPodCIDR(),fluent.getProviderID(),fluent.getTaints(),fluent.isUnschedulable());
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;
NodeSpecBuilder that = (NodeSpecBuilder) 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;
}
}