io.fabric8.kubernetes.api.model.flowcontrol.v1beta2.NonResourcePolicyRuleFluent Maven / Gradle / Ivy
The newest version!
package io.fabric8.kubernetes.api.model.flowcontrol.v1beta2;
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 NonResourcePolicyRuleFluent> extends BaseFluent{
public NonResourcePolicyRuleFluent() {
}
public NonResourcePolicyRuleFluent(NonResourcePolicyRule instance) {
this.copyInstance(instance);
}
private List nonResourceURLs = new ArrayList();
private List verbs = new ArrayList();
private Map additionalProperties;
protected void copyInstance(NonResourcePolicyRule instance) {
instance = (instance != null ? instance : new NonResourcePolicyRule());
if (instance != null) {
this.withNonResourceURLs(instance.getNonResourceURLs());
this.withVerbs(instance.getVerbs());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public A addToNonResourceURLs(int index,String item) {
if (this.nonResourceURLs == null) {this.nonResourceURLs = new ArrayList();}
this.nonResourceURLs.add(index, item);
return (A)this;
}
public A setToNonResourceURLs(int index,String item) {
if (this.nonResourceURLs == null) {this.nonResourceURLs = new ArrayList();}
this.nonResourceURLs.set(index, item); return (A)this;
}
public A addToNonResourceURLs(java.lang.String... items) {
if (this.nonResourceURLs == null) {this.nonResourceURLs = new ArrayList();}
for (String item : items) {this.nonResourceURLs.add(item);} return (A)this;
}
public A addAllToNonResourceURLs(Collection items) {
if (this.nonResourceURLs == null) {this.nonResourceURLs = new ArrayList();}
for (String item : items) {this.nonResourceURLs.add(item);} return (A)this;
}
public A removeFromNonResourceURLs(java.lang.String... items) {
if (this.nonResourceURLs == null) return (A)this;
for (String item : items) { this.nonResourceURLs.remove(item);} return (A)this;
}
public A removeAllFromNonResourceURLs(Collection items) {
if (this.nonResourceURLs == null) return (A)this;
for (String item : items) { this.nonResourceURLs.remove(item);} return (A)this;
}
public List getNonResourceURLs() {
return this.nonResourceURLs;
}
public String getNonResourceURL(int index) {
return this.nonResourceURLs.get(index);
}
public String getFirstNonResourceURL() {
return this.nonResourceURLs.get(0);
}
public String getLastNonResourceURL() {
return this.nonResourceURLs.get(nonResourceURLs.size() - 1);
}
public String getMatchingNonResourceURL(Predicate predicate) {
for (String item : nonResourceURLs) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public boolean hasMatchingNonResourceURL(Predicate predicate) {
for (String item : nonResourceURLs) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withNonResourceURLs(List nonResourceURLs) {
if (nonResourceURLs != null) {
this.nonResourceURLs = new ArrayList();
for (String item : nonResourceURLs) {
this.addToNonResourceURLs(item);
}
} else {
this.nonResourceURLs = null;
}
return (A) this;
}
public A withNonResourceURLs(java.lang.String... nonResourceURLs) {
if (this.nonResourceURLs != null) {
this.nonResourceURLs.clear();
_visitables.remove("nonResourceURLs");
}
if (nonResourceURLs != null) {
for (String item : nonResourceURLs) {
this.addToNonResourceURLs(item);
}
}
return (A) this;
}
public boolean hasNonResourceURLs() {
return this.nonResourceURLs != null && !this.nonResourceURLs.isEmpty();
}
public A addToVerbs(int index,String item) {
if (this.verbs == null) {this.verbs = new ArrayList();}
this.verbs.add(index, item);
return (A)this;
}
public A setToVerbs(int index,String item) {
if (this.verbs == null) {this.verbs = new ArrayList();}
this.verbs.set(index, item); return (A)this;
}
public A addToVerbs(java.lang.String... items) {
if (this.verbs == null) {this.verbs = new ArrayList();}
for (String item : items) {this.verbs.add(item);} return (A)this;
}
public A addAllToVerbs(Collection items) {
if (this.verbs == null) {this.verbs = new ArrayList();}
for (String item : items) {this.verbs.add(item);} return (A)this;
}
public A removeFromVerbs(java.lang.String... items) {
if (this.verbs == null) return (A)this;
for (String item : items) { this.verbs.remove(item);} return (A)this;
}
public A removeAllFromVerbs(Collection items) {
if (this.verbs == null) return (A)this;
for (String item : items) { this.verbs.remove(item);} return (A)this;
}
public List getVerbs() {
return this.verbs;
}
public String getVerb(int index) {
return this.verbs.get(index);
}
public String getFirstVerb() {
return this.verbs.get(0);
}
public String getLastVerb() {
return this.verbs.get(verbs.size() - 1);
}
public String getMatchingVerb(Predicate predicate) {
for (String item : verbs) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public boolean hasMatchingVerb(Predicate predicate) {
for (String item : verbs) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withVerbs(List verbs) {
if (verbs != null) {
this.verbs = new ArrayList();
for (String item : verbs) {
this.addToVerbs(item);
}
} else {
this.verbs = null;
}
return (A) this;
}
public A withVerbs(java.lang.String... verbs) {
if (this.verbs != null) {
this.verbs.clear();
_visitables.remove("verbs");
}
if (verbs != null) {
for (String item : verbs) {
this.addToVerbs(item);
}
}
return (A) this;
}
public boolean hasVerbs() {
return this.verbs != null && !this.verbs.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;
NonResourcePolicyRuleFluent that = (NonResourcePolicyRuleFluent) o;
if (!java.util.Objects.equals(nonResourceURLs, that.nonResourceURLs)) return false;
if (!java.util.Objects.equals(verbs, that.verbs)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(nonResourceURLs, verbs, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (nonResourceURLs != null && !nonResourceURLs.isEmpty()) { sb.append("nonResourceURLs:"); sb.append(nonResourceURLs + ","); }
if (verbs != null && !verbs.isEmpty()) { sb.append("verbs:"); sb.append(verbs + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
}