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

io.fabric8.knative.bindings.v1beta1.KafkaAuthSpecFluent Maven / Gradle / Ivy

package io.fabric8.knative.bindings.v1beta1;

import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.util.Map;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class KafkaAuthSpecFluent> extends BaseFluent{
  public KafkaAuthSpecFluent() {
  }
  
  public KafkaAuthSpecFluent(KafkaAuthSpec instance) {
    this.copyInstance(instance);
  }
  private List bootstrapServers = new ArrayList();
  private KafkaNetSpecBuilder net;
  private Map additionalProperties;
  
  protected void copyInstance(KafkaAuthSpec instance) {
    instance = (instance != null ? instance : new KafkaAuthSpec());
    if (instance != null) {
          this.withBootstrapServers(instance.getBootstrapServers());
          this.withNet(instance.getNet());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  
  public A addToBootstrapServers(int index,String item) {
    if (this.bootstrapServers == null) {this.bootstrapServers = new ArrayList();}
    this.bootstrapServers.add(index, item);
    return (A)this;
  }
  
  public A setToBootstrapServers(int index,String item) {
    if (this.bootstrapServers == null) {this.bootstrapServers = new ArrayList();}
    this.bootstrapServers.set(index, item); return (A)this;
  }
  
  public A addToBootstrapServers(java.lang.String... items) {
    if (this.bootstrapServers == null) {this.bootstrapServers = new ArrayList();}
    for (String item : items) {this.bootstrapServers.add(item);} return (A)this;
  }
  
  public A addAllToBootstrapServers(Collection items) {
    if (this.bootstrapServers == null) {this.bootstrapServers = new ArrayList();}
    for (String item : items) {this.bootstrapServers.add(item);} return (A)this;
  }
  
  public A removeFromBootstrapServers(java.lang.String... items) {
    if (this.bootstrapServers == null) return (A)this;
    for (String item : items) { this.bootstrapServers.remove(item);} return (A)this;
  }
  
  public A removeAllFromBootstrapServers(Collection items) {
    if (this.bootstrapServers == null) return (A)this;
    for (String item : items) { this.bootstrapServers.remove(item);} return (A)this;
  }
  
  public List getBootstrapServers() {
    return this.bootstrapServers;
  }
  
  public String getBootstrapServer(int index) {
    return this.bootstrapServers.get(index);
  }
  
  public String getFirstBootstrapServer() {
    return this.bootstrapServers.get(0);
  }
  
  public String getLastBootstrapServer() {
    return this.bootstrapServers.get(bootstrapServers.size() - 1);
  }
  
  public String getMatchingBootstrapServer(Predicate predicate) {
      for (String item : bootstrapServers) {
        if (predicate.test(item)) {
          return item;
        }
      }
      return null;
  }
  
  public boolean hasMatchingBootstrapServer(Predicate predicate) {
      for (String item : bootstrapServers) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withBootstrapServers(List bootstrapServers) {
    if (bootstrapServers != null) {
        this.bootstrapServers = new ArrayList();
        for (String item : bootstrapServers) {
          this.addToBootstrapServers(item);
        }
    } else {
      this.bootstrapServers = null;
    }
    return (A) this;
  }
  
  public A withBootstrapServers(java.lang.String... bootstrapServers) {
    if (this.bootstrapServers != null) {
        this.bootstrapServers.clear();
        _visitables.remove("bootstrapServers");
    }
    if (bootstrapServers != null) {
      for (String item : bootstrapServers) {
        this.addToBootstrapServers(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasBootstrapServers() {
    return this.bootstrapServers != null && !this.bootstrapServers.isEmpty();
  }
  
  public KafkaNetSpec buildNet() {
    return this.net != null ? this.net.build() : null;
  }
  
  public A withNet(KafkaNetSpec net) {
    this._visitables.remove("net");
    if (net != null) {
        this.net = new KafkaNetSpecBuilder(net);
        this._visitables.get("net").add(this.net);
    } else {
        this.net = null;
        this._visitables.get("net").remove(this.net);
    }
    return (A) this;
  }
  
  public boolean hasNet() {
    return this.net != null;
  }
  
  public NetNested withNewNet() {
    return new NetNested(null);
  }
  
  public NetNested withNewNetLike(KafkaNetSpec item) {
    return new NetNested(item);
  }
  
  public NetNested editNet() {
    return withNewNetLike(java.util.Optional.ofNullable(buildNet()).orElse(null));
  }
  
  public NetNested editOrNewNet() {
    return withNewNetLike(java.util.Optional.ofNullable(buildNet()).orElse(new KafkaNetSpecBuilder().build()));
  }
  
  public NetNested editOrNewNetLike(KafkaNetSpec item) {
    return withNewNetLike(java.util.Optional.ofNullable(buildNet()).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;
    KafkaAuthSpecFluent that = (KafkaAuthSpecFluent) o;
    if (!java.util.Objects.equals(bootstrapServers, that.bootstrapServers)) return false;
    if (!java.util.Objects.equals(net, that.net)) return false;
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(bootstrapServers,  net,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (bootstrapServers != null && !bootstrapServers.isEmpty()) { sb.append("bootstrapServers:"); sb.append(bootstrapServers + ","); }
    if (net != null) { sb.append("net:"); sb.append(net + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class NetNested extends KafkaNetSpecFluent> implements Nested{
    NetNested(KafkaNetSpec item) {
      this.builder = new KafkaNetSpecBuilder(this, item);
    }
    KafkaNetSpecBuilder builder;
    
    public N and() {
      return (N) KafkaAuthSpecFluent.this.withNet(builder.build());
    }
    
    public N endNet() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy