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

io.fabric8.knative.eventing.v1alpha1.KafkaSinkSpecFluent Maven / Gradle / Ivy

package io.fabric8.knative.eventing.v1alpha1;

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 java.lang.Integer;
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 KafkaSinkSpecFluent> extends BaseFluent{
  public KafkaSinkSpecFluent() {
  }
  
  public KafkaSinkSpecFluent(KafkaSinkSpec instance) {
    this.copyInstance(instance);
  }
  private AuthBuilder auth;
  private List bootstrapServers = new ArrayList();
  private String contentMode;
  private Integer numPartitions;
  private Integer replicationFactor;
  private String topic;
  private Map additionalProperties;
  
  protected void copyInstance(KafkaSinkSpec instance) {
    instance = (instance != null ? instance : new KafkaSinkSpec());
    if (instance != null) {
          this.withAuth(instance.getAuth());
          this.withBootstrapServers(instance.getBootstrapServers());
          this.withContentMode(instance.getContentMode());
          this.withNumPartitions(instance.getNumPartitions());
          this.withReplicationFactor(instance.getReplicationFactor());
          this.withTopic(instance.getTopic());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  
  public Auth buildAuth() {
    return this.auth != null ? this.auth.build() : null;
  }
  
  public A withAuth(Auth auth) {
    this._visitables.remove("auth");
    if (auth != null) {
        this.auth = new AuthBuilder(auth);
        this._visitables.get("auth").add(this.auth);
    } else {
        this.auth = null;
        this._visitables.get("auth").remove(this.auth);
    }
    return (A) this;
  }
  
  public boolean hasAuth() {
    return this.auth != null;
  }
  
  public AuthNested withNewAuth() {
    return new AuthNested(null);
  }
  
  public AuthNested withNewAuthLike(Auth item) {
    return new AuthNested(item);
  }
  
  public AuthNested editAuth() {
    return withNewAuthLike(java.util.Optional.ofNullable(buildAuth()).orElse(null));
  }
  
  public AuthNested editOrNewAuth() {
    return withNewAuthLike(java.util.Optional.ofNullable(buildAuth()).orElse(new AuthBuilder().build()));
  }
  
  public AuthNested editOrNewAuthLike(Auth item) {
    return withNewAuthLike(java.util.Optional.ofNullable(buildAuth()).orElse(item));
  }
  
  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 String getContentMode() {
    return this.contentMode;
  }
  
  public A withContentMode(String contentMode) {
    this.contentMode = contentMode;
    return (A) this;
  }
  
  public boolean hasContentMode() {
    return this.contentMode != null;
  }
  
  public Integer getNumPartitions() {
    return this.numPartitions;
  }
  
  public A withNumPartitions(Integer numPartitions) {
    this.numPartitions = numPartitions;
    return (A) this;
  }
  
  public boolean hasNumPartitions() {
    return this.numPartitions != null;
  }
  
  public Integer getReplicationFactor() {
    return this.replicationFactor;
  }
  
  public A withReplicationFactor(Integer replicationFactor) {
    this.replicationFactor = replicationFactor;
    return (A) this;
  }
  
  public boolean hasReplicationFactor() {
    return this.replicationFactor != null;
  }
  
  public String getTopic() {
    return this.topic;
  }
  
  public A withTopic(String topic) {
    this.topic = topic;
    return (A) this;
  }
  
  public boolean hasTopic() {
    return this.topic != null;
  }
  
  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;
    KafkaSinkSpecFluent that = (KafkaSinkSpecFluent) o;
    if (!java.util.Objects.equals(auth, that.auth)) return false;
    if (!java.util.Objects.equals(bootstrapServers, that.bootstrapServers)) return false;
    if (!java.util.Objects.equals(contentMode, that.contentMode)) return false;
    if (!java.util.Objects.equals(numPartitions, that.numPartitions)) return false;
    if (!java.util.Objects.equals(replicationFactor, that.replicationFactor)) return false;
    if (!java.util.Objects.equals(topic, that.topic)) return false;
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(auth,  bootstrapServers,  contentMode,  numPartitions,  replicationFactor,  topic,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (auth != null) { sb.append("auth:"); sb.append(auth + ","); }
    if (bootstrapServers != null && !bootstrapServers.isEmpty()) { sb.append("bootstrapServers:"); sb.append(bootstrapServers + ","); }
    if (contentMode != null) { sb.append("contentMode:"); sb.append(contentMode + ","); }
    if (numPartitions != null) { sb.append("numPartitions:"); sb.append(numPartitions + ","); }
    if (replicationFactor != null) { sb.append("replicationFactor:"); sb.append(replicationFactor + ","); }
    if (topic != null) { sb.append("topic:"); sb.append(topic + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class AuthNested extends AuthFluent> implements Nested{
    AuthNested(Auth item) {
      this.builder = new AuthBuilder(this, item);
    }
    AuthBuilder builder;
    
    public N and() {
      return (N) KafkaSinkSpecFluent.this.withAuth(builder.build());
    }
    
    public N endAuth() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy