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

annotations.io.fabric8.kubernetes.api.model.ReplicationControllerSpecFluentImpl Maven / Gradle / Ivy

There is a newer version: 4.1.1
Show newest version
package io.fabric8.kubernetes.api.model;

import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.Integer;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.lang.String;
import java.util.Map;
import javax.validation.Valid;
import java.util.LinkedHashMap;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.Object;
import io.fabric8.kubernetes.api.builder.Nested;

public class ReplicationControllerSpecFluentImpl> extends BaseFluent implements ReplicationControllerSpecFluent{

    private Integer replicas;
    private Map selector = new LinkedHashMap();
    private VisitableBuilder template;

    public ReplicationControllerSpecFluentImpl(){
    }
    public ReplicationControllerSpecFluentImpl(ReplicationControllerSpec instance){
            this.withReplicas(instance.getReplicas()); 
            this.withSelector(instance.getSelector()); 
            this.withTemplate(instance.getTemplate()); 
    }

    public Integer getReplicas(){
            return this.replicas;
    }

    public A withReplicas(Integer replicas){
            this.replicas=replicas; return (A) this;
    }

    public A addToSelector(String key,String value){
            if(key != null && value != null) {this.selector.put(key, value);} return (A)this;
    }

    public A addToSelector(Map map){
            if(map != null) { this.selector.putAll(map);} return (A)this;
    }

    public A removeFromSelector(String key){
            if(key != null) {this.selector.remove(key);} return (A)this;
    }

    public A removeFromSelector(Map map){
            if(map != null) { for(Object key : map.keySet()) {this.selector.remove(key);}} return (A)this;
    }

    public Map getSelector(){
            return this.selector;
    }

    public A withSelector(Map selector){
            this.selector.clear();
            if (selector != null) {this.selector.putAll(selector);} return (A) this;
    }

    public PodTemplateSpec getTemplate(){
            return this.template!=null?this.template.build():null;
    }

    public A withTemplate(PodTemplateSpec template){
            if (template!=null){ this.template= new PodTemplateSpecBuilder(template); _visitables.add(this.template);} return (A) this;
    }

    public ReplicationControllerSpecFluent.TemplateNested withNewTemplate(){
            return new TemplateNestedImpl();
    }

    public ReplicationControllerSpecFluent.TemplateNested withNewTemplateLike(PodTemplateSpec item){
            return new TemplateNestedImpl(item);
    }

    public ReplicationControllerSpecFluent.TemplateNested editTemplate(){
            return withNewTemplateLike(getTemplate());
    }

    public boolean equals(Object o){
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            if (!super.equals(o)) return false;
            ReplicationControllerSpecFluentImpl that = (ReplicationControllerSpecFluentImpl) o;
            if (replicas != null ? !replicas.equals(that.replicas) :that.replicas != null) return false;
            if (selector != null ? !selector.equals(that.selector) :that.selector != null) return false;
            if (template != null ? !template.equals(that.template) :that.template != null) return false;
            return true;
    }


    public class TemplateNestedImpl extends PodTemplateSpecFluentImpl> implements ReplicationControllerSpecFluent.TemplateNested,Nested{

            private final PodTemplateSpecBuilder builder;
    
            TemplateNestedImpl(){
                    this.builder = new PodTemplateSpecBuilder(this);
            }
            TemplateNestedImpl(PodTemplateSpec item){
                    this.builder = new PodTemplateSpecBuilder(this, item);
            }
    
    public N endTemplate(){
            return and();
    }
    public N and(){
            return (N) ReplicationControllerSpecFluentImpl.this.withTemplate(builder.build());
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy