io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.RAIDConfigFluentImpl Maven / Gradle / Ivy
package io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1;
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 java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import java.lang.Integer;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings(value = "unchecked")
public class RAIDConfigFluentImpl> extends BaseFluent implements RAIDConfigFluent{
public RAIDConfigFluentImpl() {
}
public RAIDConfigFluentImpl(RAIDConfig instance) {
if (instance != null) {
this.withHardwareRAIDVolumes(instance.getHardwareRAIDVolumes());
this.withSoftwareRAIDVolumes(instance.getSoftwareRAIDVolumes());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
private ArrayList hardwareRAIDVolumes = new ArrayList();
private ArrayList softwareRAIDVolumes = new ArrayList();
private Map additionalProperties;
public A addToHardwareRAIDVolumes(int index,HardwareRAIDVolume item) {
if (this.hardwareRAIDVolumes == null) {this.hardwareRAIDVolumes = new ArrayList();}
HardwareRAIDVolumeBuilder builder = new HardwareRAIDVolumeBuilder(item);
if (index < 0 || index >= hardwareRAIDVolumes.size()) { _visitables.get("hardwareRAIDVolumes").add(builder); hardwareRAIDVolumes.add(builder); } else { _visitables.get("hardwareRAIDVolumes").add(index, builder); hardwareRAIDVolumes.add(index, builder);}
return (A)this;
}
public A setToHardwareRAIDVolumes(int index,HardwareRAIDVolume item) {
if (this.hardwareRAIDVolumes == null) {this.hardwareRAIDVolumes = new ArrayList();}
HardwareRAIDVolumeBuilder builder = new HardwareRAIDVolumeBuilder(item);
if (index < 0 || index >= hardwareRAIDVolumes.size()) { _visitables.get("hardwareRAIDVolumes").add(builder); hardwareRAIDVolumes.add(builder); } else { _visitables.get("hardwareRAIDVolumes").set(index, builder); hardwareRAIDVolumes.set(index, builder);}
return (A)this;
}
public A addToHardwareRAIDVolumes(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.HardwareRAIDVolume... items) {
if (this.hardwareRAIDVolumes == null) {this.hardwareRAIDVolumes = new ArrayList();}
for (HardwareRAIDVolume item : items) {HardwareRAIDVolumeBuilder builder = new HardwareRAIDVolumeBuilder(item);_visitables.get("hardwareRAIDVolumes").add(builder);this.hardwareRAIDVolumes.add(builder);} return (A)this;
}
public A addAllToHardwareRAIDVolumes(Collection items) {
if (this.hardwareRAIDVolumes == null) {this.hardwareRAIDVolumes = new ArrayList();}
for (HardwareRAIDVolume item : items) {HardwareRAIDVolumeBuilder builder = new HardwareRAIDVolumeBuilder(item);_visitables.get("hardwareRAIDVolumes").add(builder);this.hardwareRAIDVolumes.add(builder);} return (A)this;
}
public A removeFromHardwareRAIDVolumes(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.HardwareRAIDVolume... items) {
for (HardwareRAIDVolume item : items) {HardwareRAIDVolumeBuilder builder = new HardwareRAIDVolumeBuilder(item);_visitables.get("hardwareRAIDVolumes").remove(builder);if (this.hardwareRAIDVolumes != null) {this.hardwareRAIDVolumes.remove(builder);}} return (A)this;
}
public A removeAllFromHardwareRAIDVolumes(Collection items) {
for (HardwareRAIDVolume item : items) {HardwareRAIDVolumeBuilder builder = new HardwareRAIDVolumeBuilder(item);_visitables.get("hardwareRAIDVolumes").remove(builder);if (this.hardwareRAIDVolumes != null) {this.hardwareRAIDVolumes.remove(builder);}} return (A)this;
}
public A removeMatchingFromHardwareRAIDVolumes(Predicate predicate) {
if (hardwareRAIDVolumes == null) return (A) this;
final Iterator each = hardwareRAIDVolumes.iterator();
final List visitables = _visitables.get("hardwareRAIDVolumes");
while (each.hasNext()) {
HardwareRAIDVolumeBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildHardwareRAIDVolumes instead.
* @return The buildable object.
*/
@Deprecated
public List getHardwareRAIDVolumes() {
return hardwareRAIDVolumes != null ? build(hardwareRAIDVolumes) : null;
}
public List buildHardwareRAIDVolumes() {
return hardwareRAIDVolumes != null ? build(hardwareRAIDVolumes) : null;
}
public HardwareRAIDVolume buildHardwareRAIDVolume(int index) {
return this.hardwareRAIDVolumes.get(index).build();
}
public HardwareRAIDVolume buildFirstHardwareRAIDVolume() {
return this.hardwareRAIDVolumes.get(0).build();
}
public HardwareRAIDVolume buildLastHardwareRAIDVolume() {
return this.hardwareRAIDVolumes.get(hardwareRAIDVolumes.size() - 1).build();
}
public HardwareRAIDVolume buildMatchingHardwareRAIDVolume(Predicate predicate) {
for (HardwareRAIDVolumeBuilder item: hardwareRAIDVolumes) { if(predicate.test(item)){ return item.build();} } return null;
}
public Boolean hasMatchingHardwareRAIDVolume(Predicate predicate) {
for (HardwareRAIDVolumeBuilder item: hardwareRAIDVolumes) { if(predicate.test(item)){ return true;} } return false;
}
public A withHardwareRAIDVolumes(List hardwareRAIDVolumes) {
if (this.hardwareRAIDVolumes != null) { _visitables.get("hardwareRAIDVolumes").clear();}
if (hardwareRAIDVolumes != null) {this.hardwareRAIDVolumes = new ArrayList(); for (HardwareRAIDVolume item : hardwareRAIDVolumes){this.addToHardwareRAIDVolumes(item);}} else { this.hardwareRAIDVolumes = null;} return (A) this;
}
public A withHardwareRAIDVolumes(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.HardwareRAIDVolume... hardwareRAIDVolumes) {
if (this.hardwareRAIDVolumes != null) {this.hardwareRAIDVolumes.clear(); _visitables.remove("hardwareRAIDVolumes"); }
if (hardwareRAIDVolumes != null) {for (HardwareRAIDVolume item :hardwareRAIDVolumes){ this.addToHardwareRAIDVolumes(item);}} return (A) this;
}
public Boolean hasHardwareRAIDVolumes() {
return hardwareRAIDVolumes != null && !hardwareRAIDVolumes.isEmpty();
}
public A addNewHardwareRAIDVolume(String level,String name,Integer numberOfPhysicalDisks,Boolean rotational,Integer sizeGibibytes) {
return (A)addToHardwareRAIDVolumes(new HardwareRAIDVolume(level, name, numberOfPhysicalDisks, rotational, sizeGibibytes));
}
public RAIDConfigFluentImpl.HardwareRAIDVolumesNested addNewHardwareRAIDVolume() {
return new RAIDConfigFluentImpl.HardwareRAIDVolumesNestedImpl();
}
public RAIDConfigFluentImpl.HardwareRAIDVolumesNested addNewHardwareRAIDVolumeLike(HardwareRAIDVolume item) {
return new RAIDConfigFluentImpl.HardwareRAIDVolumesNestedImpl(-1, item);
}
public RAIDConfigFluentImpl.HardwareRAIDVolumesNested setNewHardwareRAIDVolumeLike(int index,HardwareRAIDVolume item) {
return new RAIDConfigFluentImpl.HardwareRAIDVolumesNestedImpl(index, item);
}
public RAIDConfigFluentImpl.HardwareRAIDVolumesNested editHardwareRAIDVolume(int index) {
if (hardwareRAIDVolumes.size() <= index) throw new RuntimeException("Can't edit hardwareRAIDVolumes. Index exceeds size.");
return setNewHardwareRAIDVolumeLike(index, buildHardwareRAIDVolume(index));
}
public RAIDConfigFluentImpl.HardwareRAIDVolumesNested editFirstHardwareRAIDVolume() {
if (hardwareRAIDVolumes.size() == 0) throw new RuntimeException("Can't edit first hardwareRAIDVolumes. The list is empty.");
return setNewHardwareRAIDVolumeLike(0, buildHardwareRAIDVolume(0));
}
public RAIDConfigFluentImpl.HardwareRAIDVolumesNested editLastHardwareRAIDVolume() {
int index = hardwareRAIDVolumes.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last hardwareRAIDVolumes. The list is empty.");
return setNewHardwareRAIDVolumeLike(index, buildHardwareRAIDVolume(index));
}
public RAIDConfigFluentImpl.HardwareRAIDVolumesNested editMatchingHardwareRAIDVolume(Predicate predicate) {
int index = -1;
for (int i=0;i();}
SoftwareRAIDVolumeBuilder builder = new SoftwareRAIDVolumeBuilder(item);
if (index < 0 || index >= softwareRAIDVolumes.size()) { _visitables.get("softwareRAIDVolumes").add(builder); softwareRAIDVolumes.add(builder); } else { _visitables.get("softwareRAIDVolumes").add(index, builder); softwareRAIDVolumes.add(index, builder);}
return (A)this;
}
public A setToSoftwareRAIDVolumes(int index,SoftwareRAIDVolume item) {
if (this.softwareRAIDVolumes == null) {this.softwareRAIDVolumes = new ArrayList();}
SoftwareRAIDVolumeBuilder builder = new SoftwareRAIDVolumeBuilder(item);
if (index < 0 || index >= softwareRAIDVolumes.size()) { _visitables.get("softwareRAIDVolumes").add(builder); softwareRAIDVolumes.add(builder); } else { _visitables.get("softwareRAIDVolumes").set(index, builder); softwareRAIDVolumes.set(index, builder);}
return (A)this;
}
public A addToSoftwareRAIDVolumes(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.SoftwareRAIDVolume... items) {
if (this.softwareRAIDVolumes == null) {this.softwareRAIDVolumes = new ArrayList();}
for (SoftwareRAIDVolume item : items) {SoftwareRAIDVolumeBuilder builder = new SoftwareRAIDVolumeBuilder(item);_visitables.get("softwareRAIDVolumes").add(builder);this.softwareRAIDVolumes.add(builder);} return (A)this;
}
public A addAllToSoftwareRAIDVolumes(Collection items) {
if (this.softwareRAIDVolumes == null) {this.softwareRAIDVolumes = new ArrayList();}
for (SoftwareRAIDVolume item : items) {SoftwareRAIDVolumeBuilder builder = new SoftwareRAIDVolumeBuilder(item);_visitables.get("softwareRAIDVolumes").add(builder);this.softwareRAIDVolumes.add(builder);} return (A)this;
}
public A removeFromSoftwareRAIDVolumes(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.SoftwareRAIDVolume... items) {
for (SoftwareRAIDVolume item : items) {SoftwareRAIDVolumeBuilder builder = new SoftwareRAIDVolumeBuilder(item);_visitables.get("softwareRAIDVolumes").remove(builder);if (this.softwareRAIDVolumes != null) {this.softwareRAIDVolumes.remove(builder);}} return (A)this;
}
public A removeAllFromSoftwareRAIDVolumes(Collection items) {
for (SoftwareRAIDVolume item : items) {SoftwareRAIDVolumeBuilder builder = new SoftwareRAIDVolumeBuilder(item);_visitables.get("softwareRAIDVolumes").remove(builder);if (this.softwareRAIDVolumes != null) {this.softwareRAIDVolumes.remove(builder);}} return (A)this;
}
public A removeMatchingFromSoftwareRAIDVolumes(Predicate predicate) {
if (softwareRAIDVolumes == null) return (A) this;
final Iterator each = softwareRAIDVolumes.iterator();
final List visitables = _visitables.get("softwareRAIDVolumes");
while (each.hasNext()) {
SoftwareRAIDVolumeBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildSoftwareRAIDVolumes instead.
* @return The buildable object.
*/
@Deprecated
public List getSoftwareRAIDVolumes() {
return softwareRAIDVolumes != null ? build(softwareRAIDVolumes) : null;
}
public List buildSoftwareRAIDVolumes() {
return softwareRAIDVolumes != null ? build(softwareRAIDVolumes) : null;
}
public SoftwareRAIDVolume buildSoftwareRAIDVolume(int index) {
return this.softwareRAIDVolumes.get(index).build();
}
public SoftwareRAIDVolume buildFirstSoftwareRAIDVolume() {
return this.softwareRAIDVolumes.get(0).build();
}
public SoftwareRAIDVolume buildLastSoftwareRAIDVolume() {
return this.softwareRAIDVolumes.get(softwareRAIDVolumes.size() - 1).build();
}
public SoftwareRAIDVolume buildMatchingSoftwareRAIDVolume(Predicate predicate) {
for (SoftwareRAIDVolumeBuilder item: softwareRAIDVolumes) { if(predicate.test(item)){ return item.build();} } return null;
}
public Boolean hasMatchingSoftwareRAIDVolume(Predicate predicate) {
for (SoftwareRAIDVolumeBuilder item: softwareRAIDVolumes) { if(predicate.test(item)){ return true;} } return false;
}
public A withSoftwareRAIDVolumes(List softwareRAIDVolumes) {
if (this.softwareRAIDVolumes != null) { _visitables.get("softwareRAIDVolumes").clear();}
if (softwareRAIDVolumes != null) {this.softwareRAIDVolumes = new ArrayList(); for (SoftwareRAIDVolume item : softwareRAIDVolumes){this.addToSoftwareRAIDVolumes(item);}} else { this.softwareRAIDVolumes = null;} return (A) this;
}
public A withSoftwareRAIDVolumes(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.SoftwareRAIDVolume... softwareRAIDVolumes) {
if (this.softwareRAIDVolumes != null) {this.softwareRAIDVolumes.clear(); _visitables.remove("softwareRAIDVolumes"); }
if (softwareRAIDVolumes != null) {for (SoftwareRAIDVolume item :softwareRAIDVolumes){ this.addToSoftwareRAIDVolumes(item);}} return (A) this;
}
public Boolean hasSoftwareRAIDVolumes() {
return softwareRAIDVolumes != null && !softwareRAIDVolumes.isEmpty();
}
public RAIDConfigFluentImpl.SoftwareRAIDVolumesNested addNewSoftwareRAIDVolume() {
return new RAIDConfigFluentImpl.SoftwareRAIDVolumesNestedImpl();
}
public RAIDConfigFluentImpl.SoftwareRAIDVolumesNested addNewSoftwareRAIDVolumeLike(SoftwareRAIDVolume item) {
return new RAIDConfigFluentImpl.SoftwareRAIDVolumesNestedImpl(-1, item);
}
public RAIDConfigFluentImpl.SoftwareRAIDVolumesNested setNewSoftwareRAIDVolumeLike(int index,SoftwareRAIDVolume item) {
return new RAIDConfigFluentImpl.SoftwareRAIDVolumesNestedImpl(index, item);
}
public RAIDConfigFluentImpl.SoftwareRAIDVolumesNested editSoftwareRAIDVolume(int index) {
if (softwareRAIDVolumes.size() <= index) throw new RuntimeException("Can't edit softwareRAIDVolumes. Index exceeds size.");
return setNewSoftwareRAIDVolumeLike(index, buildSoftwareRAIDVolume(index));
}
public RAIDConfigFluentImpl.SoftwareRAIDVolumesNested editFirstSoftwareRAIDVolume() {
if (softwareRAIDVolumes.size() == 0) throw new RuntimeException("Can't edit first softwareRAIDVolumes. The list is empty.");
return setNewSoftwareRAIDVolumeLike(0, buildSoftwareRAIDVolume(0));
}
public RAIDConfigFluentImpl.SoftwareRAIDVolumesNested editLastSoftwareRAIDVolume() {
int index = softwareRAIDVolumes.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last softwareRAIDVolumes. The list is empty.");
return setNewSoftwareRAIDVolumeLike(index, buildSoftwareRAIDVolume(index));
}
public RAIDConfigFluentImpl.SoftwareRAIDVolumesNested editMatchingSoftwareRAIDVolume(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;
RAIDConfigFluentImpl that = (RAIDConfigFluentImpl) o;
if (!java.util.Objects.equals(hardwareRAIDVolumes, that.hardwareRAIDVolumes)) return false;
if (!java.util.Objects.equals(softwareRAIDVolumes, that.softwareRAIDVolumes)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(hardwareRAIDVolumes, softwareRAIDVolumes, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (hardwareRAIDVolumes != null) { sb.append("hardwareRAIDVolumes:"); sb.append(hardwareRAIDVolumes + ","); }
if (softwareRAIDVolumes != null) { sb.append("softwareRAIDVolumes:"); sb.append(softwareRAIDVolumes + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
class HardwareRAIDVolumesNestedImpl extends HardwareRAIDVolumeFluentImpl> implements RAIDConfigFluentImpl.HardwareRAIDVolumesNested,Nested{
HardwareRAIDVolumesNestedImpl(int index,HardwareRAIDVolume item) {
this.index = index;
this.builder = new HardwareRAIDVolumeBuilder(this, item);
}
HardwareRAIDVolumesNestedImpl() {
this.index = -1;
this.builder = new HardwareRAIDVolumeBuilder(this);
}
HardwareRAIDVolumeBuilder builder;
int index;
public N and() {
return (N) RAIDConfigFluentImpl.this.setToHardwareRAIDVolumes(index,builder.build());
}
public N endHardwareRAIDVolume() {
return and();
}
}
class SoftwareRAIDVolumesNestedImpl extends SoftwareRAIDVolumeFluentImpl> implements RAIDConfigFluentImpl.SoftwareRAIDVolumesNested,Nested{
SoftwareRAIDVolumesNestedImpl(int index,SoftwareRAIDVolume item) {
this.index = index;
this.builder = new SoftwareRAIDVolumeBuilder(this, item);
}
SoftwareRAIDVolumesNestedImpl() {
this.index = -1;
this.builder = new SoftwareRAIDVolumeBuilder(this);
}
SoftwareRAIDVolumeBuilder builder;
int index;
public N and() {
return (N) RAIDConfigFluentImpl.this.setToSoftwareRAIDVolumes(index,builder.build());
}
public N endSoftwareRAIDVolume() {
return and();
}
}
}