All Downloads are FREE. Search and download functionalities are using the official Maven repository.

annotations.io.alauda.kubernetes.api.model.extensions.DeploymentSpecBuilder Maven / Gradle / Ivy

There is a newer version: 0.2.12
Show newest version
package io.alauda.kubernetes.api.model.extensions;

import io.alauda.kubernetes.api.builder.VisitableBuilder;
import java.lang.Object;
import java.lang.Boolean;

public class DeploymentSpecBuilder extends DeploymentSpecFluentImpl implements VisitableBuilder{

    DeploymentSpecFluent fluent;
    Boolean validationEnabled;

    public DeploymentSpecBuilder(){
            this(true);
    }
    public DeploymentSpecBuilder(Boolean validationEnabled){
            this(new DeploymentSpec(), validationEnabled);
    }
    public DeploymentSpecBuilder(DeploymentSpecFluent fluent){
            this(fluent, true);
    }
    public DeploymentSpecBuilder(DeploymentSpecFluent fluent,Boolean validationEnabled){
            this(fluent, new DeploymentSpec(), validationEnabled);
    }
    public DeploymentSpecBuilder(DeploymentSpecFluent fluent,DeploymentSpec instance){
            this(fluent, instance, true);
    }
    public DeploymentSpecBuilder(DeploymentSpecFluent fluent,DeploymentSpec instance,Boolean validationEnabled){
            this.fluent = fluent; 
            fluent.withMinReadySeconds(instance.getMinReadySeconds()); 
            fluent.withPaused(instance.getPaused()); 
            fluent.withProgressDeadlineSeconds(instance.getProgressDeadlineSeconds()); 
            fluent.withReplicas(instance.getReplicas()); 
            fluent.withRevisionHistoryLimit(instance.getRevisionHistoryLimit()); 
            fluent.withRollbackTo(instance.getRollbackTo()); 
            fluent.withSelector(instance.getSelector()); 
            fluent.withStrategy(instance.getStrategy()); 
            fluent.withTemplate(instance.getTemplate()); 
            this.validationEnabled = validationEnabled; 
    }
    public DeploymentSpecBuilder(DeploymentSpec instance){
            this(instance,true);
    }
    public DeploymentSpecBuilder(DeploymentSpec instance,Boolean validationEnabled){
            this.fluent = this; 
            this.withMinReadySeconds(instance.getMinReadySeconds()); 
            this.withPaused(instance.getPaused()); 
            this.withProgressDeadlineSeconds(instance.getProgressDeadlineSeconds()); 
            this.withReplicas(instance.getReplicas()); 
            this.withRevisionHistoryLimit(instance.getRevisionHistoryLimit()); 
            this.withRollbackTo(instance.getRollbackTo()); 
            this.withSelector(instance.getSelector()); 
            this.withStrategy(instance.getStrategy()); 
            this.withTemplate(instance.getTemplate()); 
            this.validationEnabled = validationEnabled; 
    }

    public DeploymentSpec build(){
            DeploymentSpec buildable = new DeploymentSpec(fluent.getMinReadySeconds(),fluent.isPaused(),fluent.getProgressDeadlineSeconds(),fluent.getReplicas(),fluent.getRevisionHistoryLimit(),fluent.getRollbackTo(),fluent.getSelector(),fluent.getStrategy(),fluent.getTemplate());
            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;
            DeploymentSpecBuilder that = (DeploymentSpecBuilder) 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;
    }




}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy