io.fabric8.tekton.triggers.v1alpha1.NamespaceSelectorFluent Maven / Gradle / Ivy
package io.fabric8.tekton.triggers.v1alpha1;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.ArrayList;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.String;
import java.util.Map;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class NamespaceSelectorFluent> extends BaseFluent{
public NamespaceSelectorFluent() {
}
public NamespaceSelectorFluent(NamespaceSelector instance) {
this.copyInstance(instance);
}
private List matchNames = new ArrayList();
private Map additionalProperties;
protected void copyInstance(NamespaceSelector instance) {
instance = (instance != null ? instance : new NamespaceSelector());
if (instance != null) {
this.withMatchNames(instance.getMatchNames());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public A addToMatchNames(int index,String item) {
if (this.matchNames == null) {this.matchNames = new ArrayList();}
this.matchNames.add(index, item);
return (A)this;
}
public A setToMatchNames(int index,String item) {
if (this.matchNames == null) {this.matchNames = new ArrayList();}
this.matchNames.set(index, item); return (A)this;
}
public A addToMatchNames(java.lang.String... items) {
if (this.matchNames == null) {this.matchNames = new ArrayList();}
for (String item : items) {this.matchNames.add(item);} return (A)this;
}
public A addAllToMatchNames(Collection items) {
if (this.matchNames == null) {this.matchNames = new ArrayList();}
for (String item : items) {this.matchNames.add(item);} return (A)this;
}
public A removeFromMatchNames(java.lang.String... items) {
if (this.matchNames == null) return (A)this;
for (String item : items) { this.matchNames.remove(item);} return (A)this;
}
public A removeAllFromMatchNames(Collection items) {
if (this.matchNames == null) return (A)this;
for (String item : items) { this.matchNames.remove(item);} return (A)this;
}
public List getMatchNames() {
return this.matchNames;
}
public String getMatchName(int index) {
return this.matchNames.get(index);
}
public String getFirstMatchName() {
return this.matchNames.get(0);
}
public String getLastMatchName() {
return this.matchNames.get(matchNames.size() - 1);
}
public String getMatchingMatchName(Predicate predicate) {
for (String item : matchNames) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public boolean hasMatchingMatchName(Predicate predicate) {
for (String item : matchNames) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withMatchNames(List matchNames) {
if (matchNames != null) {
this.matchNames = new ArrayList();
for (String item : matchNames) {
this.addToMatchNames(item);
}
} else {
this.matchNames = null;
}
return (A) this;
}
public A withMatchNames(java.lang.String... matchNames) {
if (this.matchNames != null) {
this.matchNames.clear();
_visitables.remove("matchNames");
}
if (matchNames != null) {
for (String item : matchNames) {
this.addToMatchNames(item);
}
}
return (A) this;
}
public boolean hasMatchNames() {
return this.matchNames != null && !this.matchNames.isEmpty();
}
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;
NamespaceSelectorFluent that = (NamespaceSelectorFluent) o;
if (!java.util.Objects.equals(matchNames, that.matchNames)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(matchNames, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (matchNames != null && !matchNames.isEmpty()) { sb.append("matchNames:"); sb.append(matchNames + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
}