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

io.fabric8.openshift.api.model.machine.v1beta1.MachineSetSpecFluent Maven / Gradle / Ivy

There is a newer version: 6.13.4
Show newest version
package io.fabric8.openshift.api.model.machine.v1beta1;

import io.fabric8.kubernetes.api.model.LabelSelectorBuilder;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import io.fabric8.kubernetes.api.model.LabelSelector;
import java.lang.String;
import java.util.LinkedHashMap;
import java.lang.Integer;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.Object;
import io.fabric8.kubernetes.api.model.LabelSelectorFluent;
import java.util.Map;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class MachineSetSpecFluent> extends BaseFluent{
  public MachineSetSpecFluent() {
  }
  
  public MachineSetSpecFluent(MachineSetSpec instance) {
    this.copyInstance(instance);
  }
  private String deletePolicy;
  private Integer minReadySeconds;
  private Integer replicas;
  private LabelSelectorBuilder selector;
  private MachineTemplateSpecBuilder template;
  private Map additionalProperties;
  
  protected void copyInstance(MachineSetSpec instance) {
    instance = (instance != null ? instance : new MachineSetSpec());
  
    if (instance != null) {
        this.withDeletePolicy(instance.getDeletePolicy());
        this.withMinReadySeconds(instance.getMinReadySeconds());
        this.withReplicas(instance.getReplicas());
        this.withSelector(instance.getSelector());
        this.withTemplate(instance.getTemplate());
        this.withDeletePolicy(instance.getDeletePolicy());
        this.withMinReadySeconds(instance.getMinReadySeconds());
        this.withReplicas(instance.getReplicas());
        this.withSelector(instance.getSelector());
        this.withTemplate(instance.getTemplate());
        this.withAdditionalProperties(instance.getAdditionalProperties());
      }
  }
  
  public String getDeletePolicy() {
    return this.deletePolicy;
  }
  
  public A withDeletePolicy(String deletePolicy) {
    this.deletePolicy=deletePolicy; return (A) this;
  }
  
  public boolean hasDeletePolicy() {
    return this.deletePolicy != null;
  }
  
  public Integer getMinReadySeconds() {
    return this.minReadySeconds;
  }
  
  public A withMinReadySeconds(Integer minReadySeconds) {
    this.minReadySeconds=minReadySeconds; return (A) this;
  }
  
  public boolean hasMinReadySeconds() {
    return this.minReadySeconds != null;
  }
  
  public Integer getReplicas() {
    return this.replicas;
  }
  
  public A withReplicas(Integer replicas) {
    this.replicas=replicas; return (A) this;
  }
  
  public boolean hasReplicas() {
    return this.replicas != null;
  }
  
  public LabelSelector buildSelector() {
    return this.selector!=null ?this.selector.build():null;
  }
  
  public A withSelector(LabelSelector selector) {
    _visitables.get("selector").remove(this.selector);
    if (selector!=null){ this.selector= new LabelSelectorBuilder(selector); _visitables.get("selector").add(this.selector);} else { this.selector = null; _visitables.get("selector").remove(this.selector); } return (A) this;
  }
  
  public boolean hasSelector() {
    return this.selector != null;
  }
  
  public SelectorNested withNewSelector() {
    return new SelectorNested(null);
  }
  
  public SelectorNested withNewSelectorLike(LabelSelector item) {
    return new SelectorNested(item);
  }
  
  public SelectorNested editSelector() {
    return withNewSelectorLike(java.util.Optional.ofNullable(buildSelector()).orElse(null));
  }
  
  public SelectorNested editOrNewSelector() {
    return withNewSelectorLike(java.util.Optional.ofNullable(buildSelector()).orElse(new LabelSelectorBuilder().build()));
  }
  
  public SelectorNested editOrNewSelectorLike(LabelSelector item) {
    return withNewSelectorLike(java.util.Optional.ofNullable(buildSelector()).orElse(item));
  }
  
  public MachineTemplateSpec buildTemplate() {
    return this.template!=null ?this.template.build():null;
  }
  
  public A withTemplate(MachineTemplateSpec template) {
    _visitables.get("template").remove(this.template);
    if (template!=null){ this.template= new MachineTemplateSpecBuilder(template); _visitables.get("template").add(this.template);} else { this.template = null; _visitables.get("template").remove(this.template); } return (A) this;
  }
  
  public boolean hasTemplate() {
    return this.template != null;
  }
  
  public TemplateNested withNewTemplate() {
    return new TemplateNested(null);
  }
  
  public TemplateNested withNewTemplateLike(MachineTemplateSpec item) {
    return new TemplateNested(item);
  }
  
  public TemplateNested editTemplate() {
    return withNewTemplateLike(java.util.Optional.ofNullable(buildTemplate()).orElse(null));
  }
  
  public TemplateNested editOrNewTemplate() {
    return withNewTemplateLike(java.util.Optional.ofNullable(buildTemplate()).orElse(new MachineTemplateSpecBuilder().build()));
  }
  
  public TemplateNested editOrNewTemplateLike(MachineTemplateSpec item) {
    return withNewTemplateLike(java.util.Optional.ofNullable(buildTemplate()).orElse(item));
  }
  
  public A addToAdditionalProperties(String key,Object value) {
    if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new LinkedHashMap(); }
    if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
  }
  
  public A addToAdditionalProperties(Map map) {
    if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
    if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
  }
  
  public A removeFromAdditionalProperties(String key) {
    if(this.additionalProperties == null) { return (A) this; }
    if(key != null && this.additionalProperties != null) {this.additionalProperties.remove(key);} return (A)this;
  }
  
  public A removeFromAdditionalProperties(Map map) {
    if(this.additionalProperties == null) { return (A) this; }
    if(map != null) { for(Object key : map.keySet()) {if (this.additionalProperties != null){this.additionalProperties.remove(key);}}} return (A)this;
  }
  
  public Map getAdditionalProperties() {
    return this.additionalProperties;
  }
  
  public A withAdditionalProperties(Map additionalProperties) {
    if (additionalProperties == null) { this.additionalProperties =  null;} else {this.additionalProperties = new LinkedHashMap(additionalProperties);} return (A) this;
  }
  
  public boolean hasAdditionalProperties() {
    return this.additionalProperties != null;
  }
  
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    MachineSetSpecFluent that = (MachineSetSpecFluent) o;
    if (!java.util.Objects.equals(deletePolicy, that.deletePolicy)) return false;
  
    if (!java.util.Objects.equals(minReadySeconds, that.minReadySeconds)) return false;
  
    if (!java.util.Objects.equals(replicas, that.replicas)) return false;
  
    if (!java.util.Objects.equals(selector, that.selector)) return false;
  
    if (!java.util.Objects.equals(template, that.template)) return false;
  
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
  
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(deletePolicy,  minReadySeconds,  replicas,  selector,  template,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (deletePolicy != null) { sb.append("deletePolicy:"); sb.append(deletePolicy + ","); }
    if (minReadySeconds != null) { sb.append("minReadySeconds:"); sb.append(minReadySeconds + ","); }
    if (replicas != null) { sb.append("replicas:"); sb.append(replicas + ","); }
    if (selector != null) { sb.append("selector:"); sb.append(selector + ","); }
    if (template != null) { sb.append("template:"); sb.append(template + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class SelectorNested extends LabelSelectorFluent> implements Nested{
    SelectorNested(LabelSelector item) {
      this.builder = new LabelSelectorBuilder(this, item);
    }
    LabelSelectorBuilder builder;
    
    public N and() {
      return (N) MachineSetSpecFluent.this.withSelector(builder.build());
    }
    
    public N endSelector() {
      return and();
    }
    
  
  }
  public class TemplateNested extends MachineTemplateSpecFluent> implements Nested{
    TemplateNested(MachineTemplateSpec item) {
      this.builder = new MachineTemplateSpecBuilder(this, item);
    }
    MachineTemplateSpecBuilder builder;
    
    public N and() {
      return (N) MachineSetSpecFluent.this.withTemplate(builder.build());
    }
    
    public N endTemplate() {
      return and();
    }
    
  
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy