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

io.strimzi.api.kafka.model.podset.StrimziPodSetSpecFluent Maven / Gradle / Ivy

The newest version!
package io.strimzi.api.kafka.model.podset;

import java.lang.SuppressWarnings;
import java.util.ArrayList;
import io.fabric8.kubernetes.api.model.LabelSelector;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.String;
import io.strimzi.api.kafka.model.common.SpecFluent;
import java.util.Map;
import java.util.function.Predicate;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class StrimziPodSetSpecFluent> extends SpecFluent{
  public StrimziPodSetSpecFluent() {
  }
  
  public StrimziPodSetSpecFluent(StrimziPodSetSpec instance) {
    this.copyInstance(instance);
  }
  private LabelSelector selector;
  private List> pods;
  
  protected void copyInstance(StrimziPodSetSpec instance) {
    instance = (instance != null ? instance : new StrimziPodSetSpec());
    if (instance != null) {
          this.withSelector(instance.getSelector());
          this.withPods(instance.getPods());
        }
  }
  
  public LabelSelector getSelector() {
    return this.selector;
  }
  
  public A withSelector(LabelSelector selector) {
    this.selector = selector;
    return (A) this;
  }
  
  public boolean hasSelector() {
    return this.selector != null;
  }
  
  public A addToPods(int index,Map item) {
    if (this.pods == null) {this.pods = new ArrayList>();}
    this.pods.add(index, item);
    return (A)this;
  }
  
  public A setToPods(int index,Map item) {
    if (this.pods == null) {this.pods = new ArrayList>();}
    this.pods.set(index, item); return (A)this;
  }
  
  public A addToPods(Map... items) {
    if (this.pods == null) {this.pods = new ArrayList>();}
    for (Map item : items) {this.pods.add(item);} return (A)this;
  }
  
  public A addAllToPods(Collection> items) {
    if (this.pods == null) {this.pods = new ArrayList>();}
    for (Map item : items) {this.pods.add(item);} return (A)this;
  }
  
  public A removeFromPods(Map... items) {
    if (this.pods == null) return (A)this;
    for (Map item : items) { this.pods.remove(item);} return (A)this;
  }
  
  public A removeAllFromPods(Collection> items) {
    if (this.pods == null) return (A)this;
    for (Map item : items) { this.pods.remove(item);} return (A)this;
  }
  
  public List> getPods() {
    return this.pods;
  }
  
  public Map getPod(int index) {
    return this.pods.get(index);
  }
  
  public Map getFirstPod() {
    return this.pods.get(0);
  }
  
  public Map getLastPod() {
    return this.pods.get(pods.size() - 1);
  }
  
  public Map getMatchingPod(Predicate> predicate) {
      for (Map item : pods) {
        if (predicate.test(item)) {
          return item;
        }
      }
      return null;
  }
  
  public boolean hasMatchingPod(Predicate> predicate) {
      for (Map item : pods) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withPods(List> pods) {
    if (pods != null) {
        this.pods = new ArrayList();
        for (Map item : pods) {
          this.addToPods(item);
        }
    } else {
      this.pods = null;
    }
    return (A) this;
  }
  
  public A withPods(Map... pods) {
    if (this.pods != null) {
        this.pods.clear();
        _visitables.remove("pods");
    }
    if (pods != null) {
      for (Map item : pods) {
        this.addToPods(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasPods() {
    return this.pods != null && !this.pods.isEmpty();
  }
  
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    StrimziPodSetSpecFluent that = (StrimziPodSetSpecFluent) o;
    if (!java.util.Objects.equals(selector, that.selector)) return false;
    if (!java.util.Objects.equals(pods, that.pods)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(selector,  pods,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (selector != null) { sb.append("selector:"); sb.append(selector + ","); }
    if (pods != null && !pods.isEmpty()) { sb.append("pods:"); sb.append(pods); }
    sb.append("}");
    return sb.toString();
  }
  

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy