io.fabric8.openshift.api.model.machine.v1beta1.LifecycleHooksFluent Maven / Gradle / Ivy
package io.fabric8.openshift.api.model.machine.v1beta1;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
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.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class LifecycleHooksFluent> extends BaseFluent{
public LifecycleHooksFluent() {
}
public LifecycleHooksFluent(LifecycleHooks instance) {
this.copyInstance(instance);
}
private ArrayList preDrain = new ArrayList();
private ArrayList preTerminate = new ArrayList();
private Map additionalProperties;
protected void copyInstance(LifecycleHooks instance) {
instance = (instance != null ? instance : new LifecycleHooks());
if (instance != null) {
this.withPreDrain(instance.getPreDrain());
this.withPreTerminate(instance.getPreTerminate());
this.withPreDrain(instance.getPreDrain());
this.withPreTerminate(instance.getPreTerminate());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public A addToPreDrain(int index,LifecycleHook item) {
if (this.preDrain == null) {this.preDrain = new ArrayList();}
LifecycleHookBuilder builder = new LifecycleHookBuilder(item);
if (index < 0 || index >= preDrain.size()) { _visitables.get("preDrain").add(builder); preDrain.add(builder); } else { _visitables.get("preDrain").add(index, builder); preDrain.add(index, builder);}
return (A)this;
}
public A setToPreDrain(int index,LifecycleHook item) {
if (this.preDrain == null) {this.preDrain = new ArrayList();}
LifecycleHookBuilder builder = new LifecycleHookBuilder(item);
if (index < 0 || index >= preDrain.size()) { _visitables.get("preDrain").add(builder); preDrain.add(builder); } else { _visitables.get("preDrain").set(index, builder); preDrain.set(index, builder);}
return (A)this;
}
public A addToPreDrain(io.fabric8.openshift.api.model.machine.v1beta1.LifecycleHook... items) {
if (this.preDrain == null) {this.preDrain = new ArrayList();}
for (LifecycleHook item : items) {LifecycleHookBuilder builder = new LifecycleHookBuilder(item);_visitables.get("preDrain").add(builder);this.preDrain.add(builder);} return (A)this;
}
public A addAllToPreDrain(Collection items) {
if (this.preDrain == null) {this.preDrain = new ArrayList();}
for (LifecycleHook item : items) {LifecycleHookBuilder builder = new LifecycleHookBuilder(item);_visitables.get("preDrain").add(builder);this.preDrain.add(builder);} return (A)this;
}
public A removeFromPreDrain(io.fabric8.openshift.api.model.machine.v1beta1.LifecycleHook... items) {
if (this.preDrain == null) return (A)this;
for (LifecycleHook item : items) {LifecycleHookBuilder builder = new LifecycleHookBuilder(item);_visitables.get("preDrain").remove(builder); this.preDrain.remove(builder);} return (A)this;
}
public A removeAllFromPreDrain(Collection items) {
if (this.preDrain == null) return (A)this;
for (LifecycleHook item : items) {LifecycleHookBuilder builder = new LifecycleHookBuilder(item);_visitables.get("preDrain").remove(builder); this.preDrain.remove(builder);} return (A)this;
}
public A removeMatchingFromPreDrain(Predicate predicate) {
if (preDrain == null) return (A) this;
final Iterator each = preDrain.iterator();
final List visitables = _visitables.get("preDrain");
while (each.hasNext()) {
LifecycleHookBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildPreDrain() {
return preDrain != null ? build(preDrain) : null;
}
public LifecycleHook buildPreDrain(int index) {
return this.preDrain.get(index).build();
}
public LifecycleHook buildFirstPreDrain() {
return this.preDrain.get(0).build();
}
public LifecycleHook buildLastPreDrain() {
return this.preDrain.get(preDrain.size() - 1).build();
}
public LifecycleHook buildMatchingPreDrain(Predicate predicate) {
for (LifecycleHookBuilder item: preDrain) { if(predicate.test(item)){ return item.build();} } return null;
}
public boolean hasMatchingPreDrain(Predicate predicate) {
for (LifecycleHookBuilder item: preDrain) { if(predicate.test(item)){ return true;} } return false;
}
public A withPreDrain(List preDrain) {
if (this.preDrain != null) { _visitables.get("preDrain").clear();}
if (preDrain != null) {this.preDrain = new ArrayList(); for (LifecycleHook item : preDrain){this.addToPreDrain(item);}} else { this.preDrain = null;} return (A) this;
}
public A withPreDrain(io.fabric8.openshift.api.model.machine.v1beta1.LifecycleHook... preDrain) {
if (this.preDrain != null) {this.preDrain.clear(); _visitables.remove("preDrain"); }
if (preDrain != null) {for (LifecycleHook item :preDrain){ this.addToPreDrain(item);}} return (A) this;
}
public boolean hasPreDrain() {
return preDrain != null && !preDrain.isEmpty();
}
public A addNewPreDrain(String name,String owner) {
return (A)addToPreDrain(new LifecycleHook(name, owner));
}
public PreDrainNested addNewPreDrain() {
return new PreDrainNested(-1, null);
}
public PreDrainNested addNewPreDrainLike(LifecycleHook item) {
return new PreDrainNested(-1, item);
}
public PreDrainNested setNewPreDrainLike(int index,LifecycleHook item) {
return new PreDrainNested(index, item);
}
public PreDrainNested editPreDrain(int index) {
if (preDrain.size() <= index) throw new RuntimeException("Can't edit preDrain. Index exceeds size.");
return setNewPreDrainLike(index, buildPreDrain(index));
}
public PreDrainNested editFirstPreDrain() {
if (preDrain.size() == 0) throw new RuntimeException("Can't edit first preDrain. The list is empty.");
return setNewPreDrainLike(0, buildPreDrain(0));
}
public PreDrainNested editLastPreDrain() {
int index = preDrain.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last preDrain. The list is empty.");
return setNewPreDrainLike(index, buildPreDrain(index));
}
public PreDrainNested editMatchingPreDrain(Predicate predicate) {
int index = -1;
for (int i=0;i();}
LifecycleHookBuilder builder = new LifecycleHookBuilder(item);
if (index < 0 || index >= preTerminate.size()) { _visitables.get("preTerminate").add(builder); preTerminate.add(builder); } else { _visitables.get("preTerminate").add(index, builder); preTerminate.add(index, builder);}
return (A)this;
}
public A setToPreTerminate(int index,LifecycleHook item) {
if (this.preTerminate == null) {this.preTerminate = new ArrayList();}
LifecycleHookBuilder builder = new LifecycleHookBuilder(item);
if (index < 0 || index >= preTerminate.size()) { _visitables.get("preTerminate").add(builder); preTerminate.add(builder); } else { _visitables.get("preTerminate").set(index, builder); preTerminate.set(index, builder);}
return (A)this;
}
public A addToPreTerminate(io.fabric8.openshift.api.model.machine.v1beta1.LifecycleHook... items) {
if (this.preTerminate == null) {this.preTerminate = new ArrayList();}
for (LifecycleHook item : items) {LifecycleHookBuilder builder = new LifecycleHookBuilder(item);_visitables.get("preTerminate").add(builder);this.preTerminate.add(builder);} return (A)this;
}
public A addAllToPreTerminate(Collection items) {
if (this.preTerminate == null) {this.preTerminate = new ArrayList();}
for (LifecycleHook item : items) {LifecycleHookBuilder builder = new LifecycleHookBuilder(item);_visitables.get("preTerminate").add(builder);this.preTerminate.add(builder);} return (A)this;
}
public A removeFromPreTerminate(io.fabric8.openshift.api.model.machine.v1beta1.LifecycleHook... items) {
if (this.preTerminate == null) return (A)this;
for (LifecycleHook item : items) {LifecycleHookBuilder builder = new LifecycleHookBuilder(item);_visitables.get("preTerminate").remove(builder); this.preTerminate.remove(builder);} return (A)this;
}
public A removeAllFromPreTerminate(Collection items) {
if (this.preTerminate == null) return (A)this;
for (LifecycleHook item : items) {LifecycleHookBuilder builder = new LifecycleHookBuilder(item);_visitables.get("preTerminate").remove(builder); this.preTerminate.remove(builder);} return (A)this;
}
public A removeMatchingFromPreTerminate(Predicate predicate) {
if (preTerminate == null) return (A) this;
final Iterator each = preTerminate.iterator();
final List visitables = _visitables.get("preTerminate");
while (each.hasNext()) {
LifecycleHookBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildPreTerminate() {
return preTerminate != null ? build(preTerminate) : null;
}
public LifecycleHook buildPreTerminate(int index) {
return this.preTerminate.get(index).build();
}
public LifecycleHook buildFirstPreTerminate() {
return this.preTerminate.get(0).build();
}
public LifecycleHook buildLastPreTerminate() {
return this.preTerminate.get(preTerminate.size() - 1).build();
}
public LifecycleHook buildMatchingPreTerminate(Predicate predicate) {
for (LifecycleHookBuilder item: preTerminate) { if(predicate.test(item)){ return item.build();} } return null;
}
public boolean hasMatchingPreTerminate(Predicate predicate) {
for (LifecycleHookBuilder item: preTerminate) { if(predicate.test(item)){ return true;} } return false;
}
public A withPreTerminate(List preTerminate) {
if (this.preTerminate != null) { _visitables.get("preTerminate").clear();}
if (preTerminate != null) {this.preTerminate = new ArrayList(); for (LifecycleHook item : preTerminate){this.addToPreTerminate(item);}} else { this.preTerminate = null;} return (A) this;
}
public A withPreTerminate(io.fabric8.openshift.api.model.machine.v1beta1.LifecycleHook... preTerminate) {
if (this.preTerminate != null) {this.preTerminate.clear(); _visitables.remove("preTerminate"); }
if (preTerminate != null) {for (LifecycleHook item :preTerminate){ this.addToPreTerminate(item);}} return (A) this;
}
public boolean hasPreTerminate() {
return preTerminate != null && !preTerminate.isEmpty();
}
public A addNewPreTerminate(String name,String owner) {
return (A)addToPreTerminate(new LifecycleHook(name, owner));
}
public PreTerminateNested addNewPreTerminate() {
return new PreTerminateNested(-1, null);
}
public PreTerminateNested addNewPreTerminateLike(LifecycleHook item) {
return new PreTerminateNested(-1, item);
}
public PreTerminateNested setNewPreTerminateLike(int index,LifecycleHook item) {
return new PreTerminateNested(index, item);
}
public PreTerminateNested editPreTerminate(int index) {
if (preTerminate.size() <= index) throw new RuntimeException("Can't edit preTerminate. Index exceeds size.");
return setNewPreTerminateLike(index, buildPreTerminate(index));
}
public PreTerminateNested editFirstPreTerminate() {
if (preTerminate.size() == 0) throw new RuntimeException("Can't edit first preTerminate. The list is empty.");
return setNewPreTerminateLike(0, buildPreTerminate(0));
}
public PreTerminateNested editLastPreTerminate() {
int index = preTerminate.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last preTerminate. The list is empty.");
return setNewPreTerminateLike(index, buildPreTerminate(index));
}
public PreTerminateNested editMatchingPreTerminate(Predicate predicate) {
int index = -1;
for (int i=0;i 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;
LifecycleHooksFluent that = (LifecycleHooksFluent) o;
if (!java.util.Objects.equals(preDrain, that.preDrain)) return false;
if (!java.util.Objects.equals(preTerminate, that.preTerminate)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(preDrain, preTerminate, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (preDrain != null && !preDrain.isEmpty()) { sb.append("preDrain:"); sb.append(preDrain + ","); }
if (preTerminate != null && !preTerminate.isEmpty()) { sb.append("preTerminate:"); sb.append(preTerminate + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class PreDrainNested extends LifecycleHookFluent> implements Nested{
PreDrainNested(int index,LifecycleHook item) {
this.index = index;
this.builder = new LifecycleHookBuilder(this, item);
}
LifecycleHookBuilder builder;
int index;
public N and() {
return (N) LifecycleHooksFluent.this.setToPreDrain(index,builder.build());
}
public N endPreDrain() {
return and();
}
}
public class PreTerminateNested extends LifecycleHookFluent> implements Nested{
PreTerminateNested(int index,LifecycleHook item) {
this.index = index;
this.builder = new LifecycleHookBuilder(this, item);
}
LifecycleHookBuilder builder;
int index;
public N and() {
return (N) LifecycleHooksFluent.this.setToPreTerminate(index,builder.build());
}
public N endPreTerminate() {
return and();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy