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

io.strimzi.api.kafka.model.mirrormaker2.KafkaMirrorMaker2StatusFluent Maven / Gradle / Ivy

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

import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.strimzi.api.kafka.model.connector.AutoRestartStatusFluent;
import java.util.function.Predicate;
import io.strimzi.api.kafka.model.connect.KafkaConnectStatusFluent;
import io.strimzi.api.kafka.model.connector.AutoRestartStatusBuilder;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.util.Map;
import io.strimzi.api.kafka.model.connector.AutoRestartStatus;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class KafkaMirrorMaker2StatusFluent> extends KafkaConnectStatusFluent{
  public KafkaMirrorMaker2StatusFluent() {
  }
  
  public KafkaMirrorMaker2StatusFluent(KafkaMirrorMaker2Status instance) {
    this.copyInstance(instance);
  }
  private List> connectors;
  private ArrayList autoRestartStatuses;
  
  protected void copyInstance(KafkaMirrorMaker2Status instance) {
    instance = (instance != null ? instance : new KafkaMirrorMaker2Status());
    if (instance != null) {
          this.withConnectors(instance.getConnectors());
          this.withAutoRestartStatuses(instance.getAutoRestartStatuses());
          this.withUrl(instance.getUrl());
          this.withConnectorPlugins(instance.getConnectorPlugins());
          this.withReplicas(instance.getReplicas());
          this.withLabelSelector(instance.getLabelSelector());
          this.withConditions(instance.getConditions());
          this.withObservedGeneration(instance.getObservedGeneration());
        }
  }
  
  public A addToConnectors(int index,Map item) {
    if (this.connectors == null) {this.connectors = new ArrayList>();}
    this.connectors.add(index, item);
    return (A)this;
  }
  
  public A setToConnectors(int index,Map item) {
    if (this.connectors == null) {this.connectors = new ArrayList>();}
    this.connectors.set(index, item); return (A)this;
  }
  
  public A addToConnectors(Map... items) {
    if (this.connectors == null) {this.connectors = new ArrayList>();}
    for (Map item : items) {this.connectors.add(item);} return (A)this;
  }
  
  public A addAllToConnectors(Collection> items) {
    if (this.connectors == null) {this.connectors = new ArrayList>();}
    for (Map item : items) {this.connectors.add(item);} return (A)this;
  }
  
  public A removeFromConnectors(Map... items) {
    if (this.connectors == null) return (A)this;
    for (Map item : items) { this.connectors.remove(item);} return (A)this;
  }
  
  public A removeAllFromConnectors(Collection> items) {
    if (this.connectors == null) return (A)this;
    for (Map item : items) { this.connectors.remove(item);} return (A)this;
  }
  
  public List> getConnectors() {
    return this.connectors;
  }
  
  public Map getConnector(int index) {
    return this.connectors.get(index);
  }
  
  public Map getFirstConnector() {
    return this.connectors.get(0);
  }
  
  public Map getLastConnector() {
    return this.connectors.get(connectors.size() - 1);
  }
  
  public Map getMatchingConnector(Predicate> predicate) {
      for (Map item : connectors) {
        if (predicate.test(item)) {
          return item;
        }
      }
      return null;
  }
  
  public boolean hasMatchingConnector(Predicate> predicate) {
      for (Map item : connectors) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withConnectors(List> connectors) {
    if (connectors != null) {
        this.connectors = new ArrayList();
        for (Map item : connectors) {
          this.addToConnectors(item);
        }
    } else {
      this.connectors = null;
    }
    return (A) this;
  }
  
  public A withConnectors(Map... connectors) {
    if (this.connectors != null) {
        this.connectors.clear();
        _visitables.remove("connectors");
    }
    if (connectors != null) {
      for (Map item : connectors) {
        this.addToConnectors(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasConnectors() {
    return this.connectors != null && !this.connectors.isEmpty();
  }
  
  public A addToAutoRestartStatuses(int index,AutoRestartStatus item) {
    if (this.autoRestartStatuses == null) {this.autoRestartStatuses = new ArrayList();}
    AutoRestartStatusBuilder builder = new AutoRestartStatusBuilder(item);
    if (index < 0 || index >= autoRestartStatuses.size()) { _visitables.get("autoRestartStatuses").add(builder); autoRestartStatuses.add(builder); } else { _visitables.get("autoRestartStatuses").add(index, builder); autoRestartStatuses.add(index, builder);}
    return (A)this;
  }
  
  public A setToAutoRestartStatuses(int index,AutoRestartStatus item) {
    if (this.autoRestartStatuses == null) {this.autoRestartStatuses = new ArrayList();}
    AutoRestartStatusBuilder builder = new AutoRestartStatusBuilder(item);
    if (index < 0 || index >= autoRestartStatuses.size()) { _visitables.get("autoRestartStatuses").add(builder); autoRestartStatuses.add(builder); } else { _visitables.get("autoRestartStatuses").set(index, builder); autoRestartStatuses.set(index, builder);}
    return (A)this;
  }
  
  public A addToAutoRestartStatuses(io.strimzi.api.kafka.model.connector.AutoRestartStatus... items) {
    if (this.autoRestartStatuses == null) {this.autoRestartStatuses = new ArrayList();}
    for (AutoRestartStatus item : items) {AutoRestartStatusBuilder builder = new AutoRestartStatusBuilder(item);_visitables.get("autoRestartStatuses").add(builder);this.autoRestartStatuses.add(builder);} return (A)this;
  }
  
  public A addAllToAutoRestartStatuses(Collection items) {
    if (this.autoRestartStatuses == null) {this.autoRestartStatuses = new ArrayList();}
    for (AutoRestartStatus item : items) {AutoRestartStatusBuilder builder = new AutoRestartStatusBuilder(item);_visitables.get("autoRestartStatuses").add(builder);this.autoRestartStatuses.add(builder);} return (A)this;
  }
  
  public A removeFromAutoRestartStatuses(io.strimzi.api.kafka.model.connector.AutoRestartStatus... items) {
    if (this.autoRestartStatuses == null) return (A)this;
    for (AutoRestartStatus item : items) {AutoRestartStatusBuilder builder = new AutoRestartStatusBuilder(item);_visitables.get("autoRestartStatuses").remove(builder); this.autoRestartStatuses.remove(builder);} return (A)this;
  }
  
  public A removeAllFromAutoRestartStatuses(Collection items) {
    if (this.autoRestartStatuses == null) return (A)this;
    for (AutoRestartStatus item : items) {AutoRestartStatusBuilder builder = new AutoRestartStatusBuilder(item);_visitables.get("autoRestartStatuses").remove(builder); this.autoRestartStatuses.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromAutoRestartStatuses(Predicate predicate) {
    if (autoRestartStatuses == null) return (A) this;
    final Iterator each = autoRestartStatuses.iterator();
    final List visitables = _visitables.get("autoRestartStatuses");
    while (each.hasNext()) {
      AutoRestartStatusBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildAutoRestartStatuses() {
    return this.autoRestartStatuses != null ? build(autoRestartStatuses) : null;
  }
  
  public AutoRestartStatus buildAutoRestartStatus(int index) {
    return this.autoRestartStatuses.get(index).build();
  }
  
  public AutoRestartStatus buildFirstAutoRestartStatus() {
    return this.autoRestartStatuses.get(0).build();
  }
  
  public AutoRestartStatus buildLastAutoRestartStatus() {
    return this.autoRestartStatuses.get(autoRestartStatuses.size() - 1).build();
  }
  
  public AutoRestartStatus buildMatchingAutoRestartStatus(Predicate predicate) {
      for (AutoRestartStatusBuilder item : autoRestartStatuses) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingAutoRestartStatus(Predicate predicate) {
      for (AutoRestartStatusBuilder item : autoRestartStatuses) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withAutoRestartStatuses(List autoRestartStatuses) {
    if (this.autoRestartStatuses != null) {
      this._visitables.get("autoRestartStatuses").clear();
    }
    if (autoRestartStatuses != null) {
        this.autoRestartStatuses = new ArrayList();
        for (AutoRestartStatus item : autoRestartStatuses) {
          this.addToAutoRestartStatuses(item);
        }
    } else {
      this.autoRestartStatuses = null;
    }
    return (A) this;
  }
  
  public A withAutoRestartStatuses(io.strimzi.api.kafka.model.connector.AutoRestartStatus... autoRestartStatuses) {
    if (this.autoRestartStatuses != null) {
        this.autoRestartStatuses.clear();
        _visitables.remove("autoRestartStatuses");
    }
    if (autoRestartStatuses != null) {
      for (AutoRestartStatus item : autoRestartStatuses) {
        this.addToAutoRestartStatuses(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasAutoRestartStatuses() {
    return this.autoRestartStatuses != null && !this.autoRestartStatuses.isEmpty();
  }
  
  public AutoRestartStatusesNested addNewAutoRestartStatus() {
    return new AutoRestartStatusesNested(-1, null);
  }
  
  public AutoRestartStatusesNested addNewAutoRestartStatusLike(AutoRestartStatus item) {
    return new AutoRestartStatusesNested(-1, item);
  }
  
  public AutoRestartStatusesNested setNewAutoRestartStatusLike(int index,AutoRestartStatus item) {
    return new AutoRestartStatusesNested(index, item);
  }
  
  public AutoRestartStatusesNested editAutoRestartStatus(int index) {
    if (autoRestartStatuses.size() <= index) throw new RuntimeException("Can't edit autoRestartStatuses. Index exceeds size.");
    return setNewAutoRestartStatusLike(index, buildAutoRestartStatus(index));
  }
  
  public AutoRestartStatusesNested editFirstAutoRestartStatus() {
    if (autoRestartStatuses.size() == 0) throw new RuntimeException("Can't edit first autoRestartStatuses. The list is empty.");
    return setNewAutoRestartStatusLike(0, buildAutoRestartStatus(0));
  }
  
  public AutoRestartStatusesNested editLastAutoRestartStatus() {
    int index = autoRestartStatuses.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last autoRestartStatuses. The list is empty.");
    return setNewAutoRestartStatusLike(index, buildAutoRestartStatus(index));
  }
  
  public AutoRestartStatusesNested editMatchingAutoRestartStatus(Predicate predicate) {
    int index = -1;
    for (int i=0;i extends AutoRestartStatusFluent> implements Nested{
    AutoRestartStatusesNested(int index,AutoRestartStatus item) {
      this.index = index;
      this.builder = new AutoRestartStatusBuilder(this, item);
    }
    AutoRestartStatusBuilder builder;
    int index;
    
    public N and() {
      return (N) KafkaMirrorMaker2StatusFluent.this.setToAutoRestartStatuses(index,builder.build());
    }
    
    public N endAutoRestartStatus() {
      return and();
    }
    
  
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy