All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.RAIDConfigFluentImpl Maven / Gradle / Ivy

There is a newer version: 6.13.4
Show newest version
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) {
    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(Integer index,HardwareRAIDVolume item) {
    if (this.hardwareRAIDVolumes == null) {this.hardwareRAIDVolumes = new ArrayList();}
    HardwareRAIDVolumeBuilder builder = new HardwareRAIDVolumeBuilder(item);_visitables.get("hardwareRAIDVolumes").add(index >= 0 ? index : _visitables.get("hardwareRAIDVolumes").size(), builder);this.hardwareRAIDVolumes.add(index >= 0 ? index : hardwareRAIDVolumes.size(), builder); return (A)this;
  }
  public A setToHardwareRAIDVolumes(Integer index,HardwareRAIDVolume item) {
    if (this.hardwareRAIDVolumes == null) {this.hardwareRAIDVolumes = new ArrayList();}
    HardwareRAIDVolumeBuilder builder = new HardwareRAIDVolumeBuilder(item);
    if (index < 0 || index >= _visitables.get("hardwareRAIDVolumes").size()) { _visitables.get("hardwareRAIDVolumes").add(builder); } else { _visitables.get("hardwareRAIDVolumes").set(index, builder);}
    if (index < 0 || index >= hardwareRAIDVolumes.size()) { hardwareRAIDVolumes.add(builder); } else { 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(Integer 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").removeAll(this.hardwareRAIDVolumes);}
    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();}
    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 RAIDConfigFluent.HardwareRAIDVolumesNested addNewHardwareRAIDVolume() {
    return new RAIDConfigFluentImpl.HardwareRAIDVolumesNestedImpl();
  }
  public RAIDConfigFluent.HardwareRAIDVolumesNested addNewHardwareRAIDVolumeLike(HardwareRAIDVolume item) {
    return new RAIDConfigFluentImpl.HardwareRAIDVolumesNestedImpl(-1, item);
  }
  public RAIDConfigFluent.HardwareRAIDVolumesNested setNewHardwareRAIDVolumeLike(Integer index,HardwareRAIDVolume item) {
    return new RAIDConfigFluentImpl.HardwareRAIDVolumesNestedImpl(index, item);
  }
  public RAIDConfigFluent.HardwareRAIDVolumesNested editHardwareRAIDVolume(Integer index) {
    if (hardwareRAIDVolumes.size() <= index) throw new RuntimeException("Can't edit hardwareRAIDVolumes. Index exceeds size.");
    return setNewHardwareRAIDVolumeLike(index, buildHardwareRAIDVolume(index));
  }
  public RAIDConfigFluent.HardwareRAIDVolumesNested editFirstHardwareRAIDVolume() {
    if (hardwareRAIDVolumes.size() == 0) throw new RuntimeException("Can't edit first hardwareRAIDVolumes. The list is empty.");
    return setNewHardwareRAIDVolumeLike(0, buildHardwareRAIDVolume(0));
  }
  public RAIDConfigFluent.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 RAIDConfigFluent.HardwareRAIDVolumesNested editMatchingHardwareRAIDVolume(Predicate predicate) {
    int index = -1;
    for (int i=0;i();}
    SoftwareRAIDVolumeBuilder builder = new SoftwareRAIDVolumeBuilder(item);_visitables.get("softwareRAIDVolumes").add(index >= 0 ? index : _visitables.get("softwareRAIDVolumes").size(), builder);this.softwareRAIDVolumes.add(index >= 0 ? index : softwareRAIDVolumes.size(), builder); return (A)this;
  }
  public A setToSoftwareRAIDVolumes(Integer index,SoftwareRAIDVolume item) {
    if (this.softwareRAIDVolumes == null) {this.softwareRAIDVolumes = new ArrayList();}
    SoftwareRAIDVolumeBuilder builder = new SoftwareRAIDVolumeBuilder(item);
    if (index < 0 || index >= _visitables.get("softwareRAIDVolumes").size()) { _visitables.get("softwareRAIDVolumes").add(builder); } else { _visitables.get("softwareRAIDVolumes").set(index, builder);}
    if (index < 0 || index >= softwareRAIDVolumes.size()) { softwareRAIDVolumes.add(builder); } else { 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(Integer 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").removeAll(this.softwareRAIDVolumes);}
    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();}
    if (softwareRAIDVolumes != null) {for (SoftwareRAIDVolume item :softwareRAIDVolumes){ this.addToSoftwareRAIDVolumes(item);}} return (A) this;
  }
  public Boolean hasSoftwareRAIDVolumes() {
    return softwareRAIDVolumes != null && !softwareRAIDVolumes.isEmpty();
  }
  public RAIDConfigFluent.SoftwareRAIDVolumesNested addNewSoftwareRAIDVolume() {
    return new RAIDConfigFluentImpl.SoftwareRAIDVolumesNestedImpl();
  }
  public RAIDConfigFluent.SoftwareRAIDVolumesNested addNewSoftwareRAIDVolumeLike(SoftwareRAIDVolume item) {
    return new RAIDConfigFluentImpl.SoftwareRAIDVolumesNestedImpl(-1, item);
  }
  public RAIDConfigFluent.SoftwareRAIDVolumesNested setNewSoftwareRAIDVolumeLike(Integer index,SoftwareRAIDVolume item) {
    return new RAIDConfigFluentImpl.SoftwareRAIDVolumesNestedImpl(index, item);
  }
  public RAIDConfigFluent.SoftwareRAIDVolumesNested editSoftwareRAIDVolume(Integer index) {
    if (softwareRAIDVolumes.size() <= index) throw new RuntimeException("Can't edit softwareRAIDVolumes. Index exceeds size.");
    return setNewSoftwareRAIDVolumeLike(index, buildSoftwareRAIDVolume(index));
  }
  public RAIDConfigFluent.SoftwareRAIDVolumesNested editFirstSoftwareRAIDVolume() {
    if (softwareRAIDVolumes.size() == 0) throw new RuntimeException("Can't edit first softwareRAIDVolumes. The list is empty.");
    return setNewSoftwareRAIDVolumeLike(0, buildSoftwareRAIDVolume(0));
  }
  public RAIDConfigFluent.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 RAIDConfigFluent.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;
    RAIDConfigFluentImpl that = (RAIDConfigFluentImpl) o;
    if (hardwareRAIDVolumes != null ? !hardwareRAIDVolumes.equals(that.hardwareRAIDVolumes) :that.hardwareRAIDVolumes != null) return false;
    if (softwareRAIDVolumes != null ? !softwareRAIDVolumes.equals(that.softwareRAIDVolumes) :that.softwareRAIDVolumes != null) return false;
    if (additionalProperties != null ? !additionalProperties.equals(that.additionalProperties) :that.additionalProperties != null) 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 && !hardwareRAIDVolumes.isEmpty()) { sb.append("hardwareRAIDVolumes:"); sb.append(hardwareRAIDVolumes + ","); }
    if (softwareRAIDVolumes != null && !softwareRAIDVolumes.isEmpty()) { 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 RAIDConfigFluent.HardwareRAIDVolumesNested,Nested{
    HardwareRAIDVolumesNestedImpl(Integer index,HardwareRAIDVolume item) {
      this.index = index;
      this.builder = new HardwareRAIDVolumeBuilder(this, item);
    }
    HardwareRAIDVolumesNestedImpl() {
      this.index = -1;
      this.builder = new HardwareRAIDVolumeBuilder(this);
    }
    HardwareRAIDVolumeBuilder builder;
    Integer index;
    public N and() {
      return (N) RAIDConfigFluentImpl.this.setToHardwareRAIDVolumes(index,builder.build());
    }
    public N endHardwareRAIDVolume() {
      return and();
    }
    
  }
  class SoftwareRAIDVolumesNestedImpl extends SoftwareRAIDVolumeFluentImpl> implements RAIDConfigFluent.SoftwareRAIDVolumesNested,Nested{
    SoftwareRAIDVolumesNestedImpl(Integer index,SoftwareRAIDVolume item) {
      this.index = index;
      this.builder = new SoftwareRAIDVolumeBuilder(this, item);
    }
    SoftwareRAIDVolumesNestedImpl() {
      this.index = -1;
      this.builder = new SoftwareRAIDVolumeBuilder(this);
    }
    SoftwareRAIDVolumeBuilder builder;
    Integer index;
    public N and() {
      return (N) RAIDConfigFluentImpl.this.setToSoftwareRAIDVolumes(index,builder.build());
    }
    public N endSoftwareRAIDVolume() {
      return and();
    }
    
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy