io.kubernetes.client.openapi.models.V1NodeSelectorFluent Maven / Gradle / Ivy
package io.kubernetes.client.openapi.models;
import io.kubernetes.client.fluent.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.function.Predicate;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class V1NodeSelectorFluent> extends BaseFluent{
public V1NodeSelectorFluent() {
}
public V1NodeSelectorFluent(V1NodeSelector instance) {
this.copyInstance(instance);
}
private ArrayList nodeSelectorTerms;
protected void copyInstance(V1NodeSelector instance) {
instance = (instance != null ? instance : new V1NodeSelector());
if (instance != null) {
this.withNodeSelectorTerms(instance.getNodeSelectorTerms());
}
}
public A addToNodeSelectorTerms(int index,V1NodeSelectorTerm item) {
if (this.nodeSelectorTerms == null) {this.nodeSelectorTerms = new ArrayList();}
V1NodeSelectorTermBuilder builder = new V1NodeSelectorTermBuilder(item);
if (index < 0 || index >= nodeSelectorTerms.size()) { _visitables.get("nodeSelectorTerms").add(builder); nodeSelectorTerms.add(builder); } else { _visitables.get("nodeSelectorTerms").add(index, builder); nodeSelectorTerms.add(index, builder);}
return (A)this;
}
public A setToNodeSelectorTerms(int index,V1NodeSelectorTerm item) {
if (this.nodeSelectorTerms == null) {this.nodeSelectorTerms = new ArrayList();}
V1NodeSelectorTermBuilder builder = new V1NodeSelectorTermBuilder(item);
if (index < 0 || index >= nodeSelectorTerms.size()) { _visitables.get("nodeSelectorTerms").add(builder); nodeSelectorTerms.add(builder); } else { _visitables.get("nodeSelectorTerms").set(index, builder); nodeSelectorTerms.set(index, builder);}
return (A)this;
}
public A addToNodeSelectorTerms(io.kubernetes.client.openapi.models.V1NodeSelectorTerm... items) {
if (this.nodeSelectorTerms == null) {this.nodeSelectorTerms = new ArrayList();}
for (V1NodeSelectorTerm item : items) {V1NodeSelectorTermBuilder builder = new V1NodeSelectorTermBuilder(item);_visitables.get("nodeSelectorTerms").add(builder);this.nodeSelectorTerms.add(builder);} return (A)this;
}
public A addAllToNodeSelectorTerms(Collection items) {
if (this.nodeSelectorTerms == null) {this.nodeSelectorTerms = new ArrayList();}
for (V1NodeSelectorTerm item : items) {V1NodeSelectorTermBuilder builder = new V1NodeSelectorTermBuilder(item);_visitables.get("nodeSelectorTerms").add(builder);this.nodeSelectorTerms.add(builder);} return (A)this;
}
public A removeFromNodeSelectorTerms(io.kubernetes.client.openapi.models.V1NodeSelectorTerm... items) {
if (this.nodeSelectorTerms == null) return (A)this;
for (V1NodeSelectorTerm item : items) {V1NodeSelectorTermBuilder builder = new V1NodeSelectorTermBuilder(item);_visitables.get("nodeSelectorTerms").remove(builder); this.nodeSelectorTerms.remove(builder);} return (A)this;
}
public A removeAllFromNodeSelectorTerms(Collection items) {
if (this.nodeSelectorTerms == null) return (A)this;
for (V1NodeSelectorTerm item : items) {V1NodeSelectorTermBuilder builder = new V1NodeSelectorTermBuilder(item);_visitables.get("nodeSelectorTerms").remove(builder); this.nodeSelectorTerms.remove(builder);} return (A)this;
}
public A removeMatchingFromNodeSelectorTerms(Predicate predicate) {
if (nodeSelectorTerms == null) return (A) this;
final Iterator each = nodeSelectorTerms.iterator();
final List visitables = _visitables.get("nodeSelectorTerms");
while (each.hasNext()) {
V1NodeSelectorTermBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildNodeSelectorTerms() {
return this.nodeSelectorTerms != null ? build(nodeSelectorTerms) : null;
}
public V1NodeSelectorTerm buildNodeSelectorTerm(int index) {
return this.nodeSelectorTerms.get(index).build();
}
public V1NodeSelectorTerm buildFirstNodeSelectorTerm() {
return this.nodeSelectorTerms.get(0).build();
}
public V1NodeSelectorTerm buildLastNodeSelectorTerm() {
return this.nodeSelectorTerms.get(nodeSelectorTerms.size() - 1).build();
}
public V1NodeSelectorTerm buildMatchingNodeSelectorTerm(Predicate predicate) {
for (V1NodeSelectorTermBuilder item : nodeSelectorTerms) {
if (predicate.test(item)) {
return item.build();
}
}
return null;
}
public boolean hasMatchingNodeSelectorTerm(Predicate predicate) {
for (V1NodeSelectorTermBuilder item : nodeSelectorTerms) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withNodeSelectorTerms(List nodeSelectorTerms) {
if (this.nodeSelectorTerms != null) {
this._visitables.get("nodeSelectorTerms").clear();
}
if (nodeSelectorTerms != null) {
this.nodeSelectorTerms = new ArrayList();
for (V1NodeSelectorTerm item : nodeSelectorTerms) {
this.addToNodeSelectorTerms(item);
}
} else {
this.nodeSelectorTerms = null;
}
return (A) this;
}
public A withNodeSelectorTerms(io.kubernetes.client.openapi.models.V1NodeSelectorTerm... nodeSelectorTerms) {
if (this.nodeSelectorTerms != null) {
this.nodeSelectorTerms.clear();
_visitables.remove("nodeSelectorTerms");
}
if (nodeSelectorTerms != null) {
for (V1NodeSelectorTerm item : nodeSelectorTerms) {
this.addToNodeSelectorTerms(item);
}
}
return (A) this;
}
public boolean hasNodeSelectorTerms() {
return this.nodeSelectorTerms != null && !this.nodeSelectorTerms.isEmpty();
}
public NodeSelectorTermsNested addNewNodeSelectorTerm() {
return new NodeSelectorTermsNested(-1, null);
}
public NodeSelectorTermsNested addNewNodeSelectorTermLike(V1NodeSelectorTerm item) {
return new NodeSelectorTermsNested(-1, item);
}
public NodeSelectorTermsNested setNewNodeSelectorTermLike(int index,V1NodeSelectorTerm item) {
return new NodeSelectorTermsNested(index, item);
}
public NodeSelectorTermsNested editNodeSelectorTerm(int index) {
if (nodeSelectorTerms.size() <= index) throw new RuntimeException("Can't edit nodeSelectorTerms. Index exceeds size.");
return setNewNodeSelectorTermLike(index, buildNodeSelectorTerm(index));
}
public NodeSelectorTermsNested editFirstNodeSelectorTerm() {
if (nodeSelectorTerms.size() == 0) throw new RuntimeException("Can't edit first nodeSelectorTerms. The list is empty.");
return setNewNodeSelectorTermLike(0, buildNodeSelectorTerm(0));
}
public NodeSelectorTermsNested editLastNodeSelectorTerm() {
int index = nodeSelectorTerms.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last nodeSelectorTerms. The list is empty.");
return setNewNodeSelectorTermLike(index, buildNodeSelectorTerm(index));
}
public NodeSelectorTermsNested editMatchingNodeSelectorTerm(Predicate predicate) {
int index = -1;
for (int i=0;i extends V1NodeSelectorTermFluent> implements Nested{
NodeSelectorTermsNested(int index,V1NodeSelectorTerm item) {
this.index = index;
this.builder = new V1NodeSelectorTermBuilder(this, item);
}
V1NodeSelectorTermBuilder builder;
int index;
public N and() {
return (N) V1NodeSelectorFluent.this.setToNodeSelectorTerms(index,builder.build());
}
public N endNodeSelectorTerm() {
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy