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

io.dekorate.halkyon.model.ComponentSpecBuilder Maven / Gradle / Ivy

There is a newer version: 2.0.0.beta2
Show newest version
package io.dekorate.halkyon.model;

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

public class ComponentSpecBuilder extends ComponentSpecFluentImpl implements VisitableBuilder {

    ComponentSpecFluent fluent;
    Boolean validationEnabled;

    public ComponentSpecBuilder() { 
        this(true);
    }


    public ComponentSpecBuilder(Boolean validationEnabled) { 
        this(new ComponentSpec(), validationEnabled);
    }


    public ComponentSpecBuilder(ComponentSpecFluent fluent) { 
        this(fluent, true);
    }


    public ComponentSpecBuilder(ComponentSpecFluent fluent,Boolean validationEnabled) { 
        this(fluent, new ComponentSpec(), validationEnabled);
    }


    public ComponentSpecBuilder(ComponentSpecFluent fluent,ComponentSpec instance) { 
        this(fluent, instance, true);
    }


    public ComponentSpecBuilder(ComponentSpecFluent fluent,ComponentSpec instance,Boolean validationEnabled) { 
        this.fluent = fluent; 
        fluent.withDeploymentMode(instance.getDeploymentMode()); 
        fluent.withRuntime(instance.getRuntime()); 
        fluent.withVersion(instance.getVersion()); 
        fluent.withExposeService(instance.isExposeService()); 
        fluent.withPort(instance.getPort()); 
        fluent.withStorage(instance.getStorage()); 
        fluent.withEnvs(instance.getEnvs()); 
        fluent.withBuildConfig(instance.getBuildConfig()); 
        fluent.withCapabilities(instance.getCapabilities()); 
        this.validationEnabled = validationEnabled; 
    }


    public ComponentSpecBuilder(ComponentSpec instance) { 
        this(instance,true);
    }


    public ComponentSpecBuilder(ComponentSpec instance,Boolean validationEnabled) { 
        this.fluent = this; 
        this.withDeploymentMode(instance.getDeploymentMode()); 
        this.withRuntime(instance.getRuntime()); 
        this.withVersion(instance.getVersion()); 
        this.withExposeService(instance.isExposeService()); 
        this.withPort(instance.getPort()); 
        this.withStorage(instance.getStorage()); 
        this.withEnvs(instance.getEnvs()); 
        this.withBuildConfig(instance.getBuildConfig()); 
        this.withCapabilities(instance.getCapabilities()); 
        this.validationEnabled = validationEnabled; 
    }


    public ComponentSpec build() {
        ComponentSpec buildable = new ComponentSpec(fluent.getDeploymentMode(),fluent.getRuntime(),fluent.getVersion(),fluent.isExposeService(),fluent.getPort(),fluent.getStorage(),fluent.getEnvs(),fluent.getBuildConfig(),fluent.getCapabilities());
        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;
        ComponentSpecBuilder that = (ComponentSpecBuilder) 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;
    }

    public int hashCode() {
        return java.util.Objects.hash(fluent,  validationEnabled,  super.hashCode());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy