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

annotations.io.alauda.kubernetes.api.model.AffinityBuilder Maven / Gradle / Ivy

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

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

public class AffinityBuilder extends AffinityFluentImpl implements VisitableBuilder{

    AffinityFluent fluent;
    Boolean validationEnabled;

    public AffinityBuilder(){
            this(true);
    }
    public AffinityBuilder(Boolean validationEnabled){
            this(new Affinity(), validationEnabled);
    }
    public AffinityBuilder(AffinityFluent fluent){
            this(fluent, true);
    }
    public AffinityBuilder(AffinityFluent fluent,Boolean validationEnabled){
            this(fluent, new Affinity(), validationEnabled);
    }
    public AffinityBuilder(AffinityFluent fluent,Affinity instance){
            this(fluent, instance, true);
    }
    public AffinityBuilder(AffinityFluent fluent,Affinity instance,Boolean validationEnabled){
            this.fluent = fluent; 
            fluent.withNodeAffinity(instance.getNodeAffinity()); 
            fluent.withPodAffinity(instance.getPodAffinity()); 
            fluent.withPodAntiAffinity(instance.getPodAntiAffinity()); 
            this.validationEnabled = validationEnabled; 
    }
    public AffinityBuilder(Affinity instance){
            this(instance,true);
    }
    public AffinityBuilder(Affinity instance,Boolean validationEnabled){
            this.fluent = this; 
            this.withNodeAffinity(instance.getNodeAffinity()); 
            this.withPodAffinity(instance.getPodAffinity()); 
            this.withPodAntiAffinity(instance.getPodAntiAffinity()); 
            this.validationEnabled = validationEnabled; 
    }

    public Affinity build(){
            Affinity buildable = new Affinity(fluent.getNodeAffinity(),fluent.getPodAffinity(),fluent.getPodAntiAffinity());
            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;
            AffinityBuilder that = (AffinityBuilder) 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