io.fabric8.knative.bindings.v1.KafkaBindingSpecFluent Maven / Gradle / Ivy
package io.fabric8.knative.bindings.v1;
import io.fabric8.knative.pkg.tracker.Reference;
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.knative.pkg.tracker.ReferenceFluent;
import io.fabric8.knative.pkg.tracker.ReferenceBuilder;
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 KafkaBindingSpecFluent> extends BaseFluent{
public KafkaBindingSpecFluent() {
}
public KafkaBindingSpecFluent(KafkaBindingSpec instance) {
this.copyInstance(instance);
}
private List bootstrapServers = new ArrayList();
private KafkaNetSpecBuilder net;
private ReferenceBuilder subject;
private Map additionalProperties;
protected void copyInstance(KafkaBindingSpec instance) {
instance = (instance != null ? instance : new KafkaBindingSpec());
if (instance != null) {
this.withBootstrapServers(instance.getBootstrapServers());
this.withNet(instance.getNet());
this.withSubject(instance.getSubject());
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 Reference buildSubject() {
return this.subject != null ? this.subject.build() : null;
}
public A withSubject(Reference subject) {
this._visitables.remove("subject");
if (subject != null) {
this.subject = new ReferenceBuilder(subject);
this._visitables.get("subject").add(this.subject);
} else {
this.subject = null;
this._visitables.get("subject").remove(this.subject);
}
return (A) this;
}
public boolean hasSubject() {
return this.subject != null;
}
public SubjectNested withNewSubject() {
return new SubjectNested(null);
}
public SubjectNested withNewSubjectLike(Reference item) {
return new SubjectNested(item);
}
public SubjectNested editSubject() {
return withNewSubjectLike(java.util.Optional.ofNullable(buildSubject()).orElse(null));
}
public SubjectNested editOrNewSubject() {
return withNewSubjectLike(java.util.Optional.ofNullable(buildSubject()).orElse(new ReferenceBuilder().build()));
}
public SubjectNested editOrNewSubjectLike(Reference item) {
return withNewSubjectLike(java.util.Optional.ofNullable(buildSubject()).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;
KafkaBindingSpecFluent that = (KafkaBindingSpecFluent) 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(subject, that.subject)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(bootstrapServers, net, subject, 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 (subject != null) { sb.append("subject:"); sb.append(subject + ","); }
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) KafkaBindingSpecFluent.this.withNet(builder.build());
}
public N endNet() {
return and();
}
}
public class SubjectNested extends ReferenceFluent> implements Nested{
SubjectNested(Reference item) {
this.builder = new ReferenceBuilder(this, item);
}
ReferenceBuilder builder;
public N and() {
return (N) KafkaBindingSpecFluent.this.withSubject(builder.build());
}
public N endSubject() {
return and();
}
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy