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

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

There is a newer version: 0.44.0
Show newest version
package io.strimzi.api.kafka.model.mirrormaker2;

import io.strimzi.api.kafka.model.connect.AbstractKafkaConnectSpecFluent;
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 java.util.function.Predicate;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class KafkaMirrorMaker2SpecFluent> extends AbstractKafkaConnectSpecFluent{
  public KafkaMirrorMaker2SpecFluent() {
  }
  
  public KafkaMirrorMaker2SpecFluent(KafkaMirrorMaker2Spec instance) {
    this.copyInstance(instance);
  }
  private ArrayList clusters;
  private String connectCluster;
  private ArrayList mirrors;
  
  protected void copyInstance(KafkaMirrorMaker2Spec instance) {
    instance = (instance != null ? instance : new KafkaMirrorMaker2Spec());
    if (instance != null) {
          this.withClusters(instance.getClusters());
          this.withConnectCluster(instance.getConnectCluster());
          this.withMirrors(instance.getMirrors());
          this.withLogging(instance.getLogging());
          this.withReplicas(instance.getReplicas());
          this.withVersion(instance.getVersion());
          this.withImage(instance.getImage());
          this.withResources(instance.getResources());
          this.withLivenessProbe(instance.getLivenessProbe());
          this.withReadinessProbe(instance.getReadinessProbe());
          this.withJmxOptions(instance.getJmxOptions());
          this.withJvmOptions(instance.getJvmOptions());
          this.withMetricsConfig(instance.getMetricsConfig());
          this.withTracing(instance.getTracing());
          this.withTemplate(instance.getTemplate());
          this.withExternalConfiguration(instance.getExternalConfiguration());
          this.withClientRackInitImage(instance.getClientRackInitImage());
          this.withRack(instance.getRack());
        }
  }
  
  public A addToClusters(int index,KafkaMirrorMaker2ClusterSpec item) {
    if (this.clusters == null) {this.clusters = new ArrayList();}
    KafkaMirrorMaker2ClusterSpecBuilder builder = new KafkaMirrorMaker2ClusterSpecBuilder(item);
    if (index < 0 || index >= clusters.size()) { _visitables.get("clusters").add(builder); clusters.add(builder); } else { _visitables.get("clusters").add(index, builder); clusters.add(index, builder);}
    return (A)this;
  }
  
  public A setToClusters(int index,KafkaMirrorMaker2ClusterSpec item) {
    if (this.clusters == null) {this.clusters = new ArrayList();}
    KafkaMirrorMaker2ClusterSpecBuilder builder = new KafkaMirrorMaker2ClusterSpecBuilder(item);
    if (index < 0 || index >= clusters.size()) { _visitables.get("clusters").add(builder); clusters.add(builder); } else { _visitables.get("clusters").set(index, builder); clusters.set(index, builder);}
    return (A)this;
  }
  
  public A addToClusters(io.strimzi.api.kafka.model.mirrormaker2.KafkaMirrorMaker2ClusterSpec... items) {
    if (this.clusters == null) {this.clusters = new ArrayList();}
    for (KafkaMirrorMaker2ClusterSpec item : items) {KafkaMirrorMaker2ClusterSpecBuilder builder = new KafkaMirrorMaker2ClusterSpecBuilder(item);_visitables.get("clusters").add(builder);this.clusters.add(builder);} return (A)this;
  }
  
  public A addAllToClusters(Collection items) {
    if (this.clusters == null) {this.clusters = new ArrayList();}
    for (KafkaMirrorMaker2ClusterSpec item : items) {KafkaMirrorMaker2ClusterSpecBuilder builder = new KafkaMirrorMaker2ClusterSpecBuilder(item);_visitables.get("clusters").add(builder);this.clusters.add(builder);} return (A)this;
  }
  
  public A removeFromClusters(io.strimzi.api.kafka.model.mirrormaker2.KafkaMirrorMaker2ClusterSpec... items) {
    if (this.clusters == null) return (A)this;
    for (KafkaMirrorMaker2ClusterSpec item : items) {KafkaMirrorMaker2ClusterSpecBuilder builder = new KafkaMirrorMaker2ClusterSpecBuilder(item);_visitables.get("clusters").remove(builder); this.clusters.remove(builder);} return (A)this;
  }
  
  public A removeAllFromClusters(Collection items) {
    if (this.clusters == null) return (A)this;
    for (KafkaMirrorMaker2ClusterSpec item : items) {KafkaMirrorMaker2ClusterSpecBuilder builder = new KafkaMirrorMaker2ClusterSpecBuilder(item);_visitables.get("clusters").remove(builder); this.clusters.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromClusters(Predicate predicate) {
    if (clusters == null) return (A) this;
    final Iterator each = clusters.iterator();
    final List visitables = _visitables.get("clusters");
    while (each.hasNext()) {
      KafkaMirrorMaker2ClusterSpecBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildClusters() {
    return this.clusters != null ? build(clusters) : null;
  }
  
  public KafkaMirrorMaker2ClusterSpec buildCluster(int index) {
    return this.clusters.get(index).build();
  }
  
  public KafkaMirrorMaker2ClusterSpec buildFirstCluster() {
    return this.clusters.get(0).build();
  }
  
  public KafkaMirrorMaker2ClusterSpec buildLastCluster() {
    return this.clusters.get(clusters.size() - 1).build();
  }
  
  public KafkaMirrorMaker2ClusterSpec buildMatchingCluster(Predicate predicate) {
      for (KafkaMirrorMaker2ClusterSpecBuilder item : clusters) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingCluster(Predicate predicate) {
      for (KafkaMirrorMaker2ClusterSpecBuilder item : clusters) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withClusters(List clusters) {
    if (this.clusters != null) {
      this._visitables.get("clusters").clear();
    }
    if (clusters != null) {
        this.clusters = new ArrayList();
        for (KafkaMirrorMaker2ClusterSpec item : clusters) {
          this.addToClusters(item);
        }
    } else {
      this.clusters = null;
    }
    return (A) this;
  }
  
  public A withClusters(io.strimzi.api.kafka.model.mirrormaker2.KafkaMirrorMaker2ClusterSpec... clusters) {
    if (this.clusters != null) {
        this.clusters.clear();
        _visitables.remove("clusters");
    }
    if (clusters != null) {
      for (KafkaMirrorMaker2ClusterSpec item : clusters) {
        this.addToClusters(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasClusters() {
    return this.clusters != null && !this.clusters.isEmpty();
  }
  
  public ClustersNested addNewCluster() {
    return new ClustersNested(-1, null);
  }
  
  public ClustersNested addNewClusterLike(KafkaMirrorMaker2ClusterSpec item) {
    return new ClustersNested(-1, item);
  }
  
  public ClustersNested setNewClusterLike(int index,KafkaMirrorMaker2ClusterSpec item) {
    return new ClustersNested(index, item);
  }
  
  public ClustersNested editCluster(int index) {
    if (clusters.size() <= index) throw new RuntimeException("Can't edit clusters. Index exceeds size.");
    return setNewClusterLike(index, buildCluster(index));
  }
  
  public ClustersNested editFirstCluster() {
    if (clusters.size() == 0) throw new RuntimeException("Can't edit first clusters. The list is empty.");
    return setNewClusterLike(0, buildCluster(0));
  }
  
  public ClustersNested editLastCluster() {
    int index = clusters.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last clusters. The list is empty.");
    return setNewClusterLike(index, buildCluster(index));
  }
  
  public ClustersNested editMatchingCluster(Predicate predicate) {
    int index = -1;
    for (int i=0;i();}
    KafkaMirrorMaker2MirrorSpecBuilder builder = new KafkaMirrorMaker2MirrorSpecBuilder(item);
    if (index < 0 || index >= mirrors.size()) { _visitables.get("mirrors").add(builder); mirrors.add(builder); } else { _visitables.get("mirrors").add(index, builder); mirrors.add(index, builder);}
    return (A)this;
  }
  
  public A setToMirrors(int index,KafkaMirrorMaker2MirrorSpec item) {
    if (this.mirrors == null) {this.mirrors = new ArrayList();}
    KafkaMirrorMaker2MirrorSpecBuilder builder = new KafkaMirrorMaker2MirrorSpecBuilder(item);
    if (index < 0 || index >= mirrors.size()) { _visitables.get("mirrors").add(builder); mirrors.add(builder); } else { _visitables.get("mirrors").set(index, builder); mirrors.set(index, builder);}
    return (A)this;
  }
  
  public A addToMirrors(io.strimzi.api.kafka.model.mirrormaker2.KafkaMirrorMaker2MirrorSpec... items) {
    if (this.mirrors == null) {this.mirrors = new ArrayList();}
    for (KafkaMirrorMaker2MirrorSpec item : items) {KafkaMirrorMaker2MirrorSpecBuilder builder = new KafkaMirrorMaker2MirrorSpecBuilder(item);_visitables.get("mirrors").add(builder);this.mirrors.add(builder);} return (A)this;
  }
  
  public A addAllToMirrors(Collection items) {
    if (this.mirrors == null) {this.mirrors = new ArrayList();}
    for (KafkaMirrorMaker2MirrorSpec item : items) {KafkaMirrorMaker2MirrorSpecBuilder builder = new KafkaMirrorMaker2MirrorSpecBuilder(item);_visitables.get("mirrors").add(builder);this.mirrors.add(builder);} return (A)this;
  }
  
  public A removeFromMirrors(io.strimzi.api.kafka.model.mirrormaker2.KafkaMirrorMaker2MirrorSpec... items) {
    if (this.mirrors == null) return (A)this;
    for (KafkaMirrorMaker2MirrorSpec item : items) {KafkaMirrorMaker2MirrorSpecBuilder builder = new KafkaMirrorMaker2MirrorSpecBuilder(item);_visitables.get("mirrors").remove(builder); this.mirrors.remove(builder);} return (A)this;
  }
  
  public A removeAllFromMirrors(Collection items) {
    if (this.mirrors == null) return (A)this;
    for (KafkaMirrorMaker2MirrorSpec item : items) {KafkaMirrorMaker2MirrorSpecBuilder builder = new KafkaMirrorMaker2MirrorSpecBuilder(item);_visitables.get("mirrors").remove(builder); this.mirrors.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromMirrors(Predicate predicate) {
    if (mirrors == null) return (A) this;
    final Iterator each = mirrors.iterator();
    final List visitables = _visitables.get("mirrors");
    while (each.hasNext()) {
      KafkaMirrorMaker2MirrorSpecBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildMirrors() {
    return this.mirrors != null ? build(mirrors) : null;
  }
  
  public KafkaMirrorMaker2MirrorSpec buildMirror(int index) {
    return this.mirrors.get(index).build();
  }
  
  public KafkaMirrorMaker2MirrorSpec buildFirstMirror() {
    return this.mirrors.get(0).build();
  }
  
  public KafkaMirrorMaker2MirrorSpec buildLastMirror() {
    return this.mirrors.get(mirrors.size() - 1).build();
  }
  
  public KafkaMirrorMaker2MirrorSpec buildMatchingMirror(Predicate predicate) {
      for (KafkaMirrorMaker2MirrorSpecBuilder item : mirrors) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingMirror(Predicate predicate) {
      for (KafkaMirrorMaker2MirrorSpecBuilder item : mirrors) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withMirrors(List mirrors) {
    if (this.mirrors != null) {
      this._visitables.get("mirrors").clear();
    }
    if (mirrors != null) {
        this.mirrors = new ArrayList();
        for (KafkaMirrorMaker2MirrorSpec item : mirrors) {
          this.addToMirrors(item);
        }
    } else {
      this.mirrors = null;
    }
    return (A) this;
  }
  
  public A withMirrors(io.strimzi.api.kafka.model.mirrormaker2.KafkaMirrorMaker2MirrorSpec... mirrors) {
    if (this.mirrors != null) {
        this.mirrors.clear();
        _visitables.remove("mirrors");
    }
    if (mirrors != null) {
      for (KafkaMirrorMaker2MirrorSpec item : mirrors) {
        this.addToMirrors(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasMirrors() {
    return this.mirrors != null && !this.mirrors.isEmpty();
  }
  
  public MirrorsNested addNewMirror() {
    return new MirrorsNested(-1, null);
  }
  
  public MirrorsNested addNewMirrorLike(KafkaMirrorMaker2MirrorSpec item) {
    return new MirrorsNested(-1, item);
  }
  
  public MirrorsNested setNewMirrorLike(int index,KafkaMirrorMaker2MirrorSpec item) {
    return new MirrorsNested(index, item);
  }
  
  public MirrorsNested editMirror(int index) {
    if (mirrors.size() <= index) throw new RuntimeException("Can't edit mirrors. Index exceeds size.");
    return setNewMirrorLike(index, buildMirror(index));
  }
  
  public MirrorsNested editFirstMirror() {
    if (mirrors.size() == 0) throw new RuntimeException("Can't edit first mirrors. The list is empty.");
    return setNewMirrorLike(0, buildMirror(0));
  }
  
  public MirrorsNested editLastMirror() {
    int index = mirrors.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last mirrors. The list is empty.");
    return setNewMirrorLike(index, buildMirror(index));
  }
  
  public MirrorsNested editMatchingMirror(Predicate predicate) {
    int index = -1;
    for (int i=0;i extends KafkaMirrorMaker2ClusterSpecFluent> implements Nested{
    ClustersNested(int index,KafkaMirrorMaker2ClusterSpec item) {
      this.index = index;
      this.builder = new KafkaMirrorMaker2ClusterSpecBuilder(this, item);
    }
    KafkaMirrorMaker2ClusterSpecBuilder builder;
    int index;
    
    public N and() {
      return (N) KafkaMirrorMaker2SpecFluent.this.setToClusters(index,builder.build());
    }
    
    public N endCluster() {
      return and();
    }
    
  
  }
  public class MirrorsNested extends KafkaMirrorMaker2MirrorSpecFluent> implements Nested{
    MirrorsNested(int index,KafkaMirrorMaker2MirrorSpec item) {
      this.index = index;
      this.builder = new KafkaMirrorMaker2MirrorSpecBuilder(this, item);
    }
    KafkaMirrorMaker2MirrorSpecBuilder builder;
    int index;
    
    public N and() {
      return (N) KafkaMirrorMaker2SpecFluent.this.setToMirrors(index,builder.build());
    }
    
    public N endMirror() {
      return and();
    }
    
  
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy