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

io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.SoftwareRAIDVolumeFluentImpl 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.Integer;
import java.lang.Deprecated;
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.lang.Boolean;
import java.util.Map;

 /**
  * Generated
  */
  @SuppressWarnings(value = "unchecked")
  public class SoftwareRAIDVolumeFluentImpl> extends BaseFluent implements SoftwareRAIDVolumeFluent{
  public SoftwareRAIDVolumeFluentImpl() {
  }
  public SoftwareRAIDVolumeFluentImpl(SoftwareRAIDVolume instance) {
    this.withLevel(instance.getLevel()); 
    this.withPhysicalDisks(instance.getPhysicalDisks()); 
    this.withSizeGibibytes(instance.getSizeGibibytes()); 
    this.withAdditionalProperties(instance.getAdditionalProperties());

  }
  private String level;
  private ArrayList physicalDisks = new ArrayList();
  private Integer sizeGibibytes;
  private Map additionalProperties;
  public String getLevel() {
    return this.level;
  }
  public A withLevel(String level) {
    this.level=level; return (A) this;
  }
  public Boolean hasLevel() {
    return this.level != null;
  }
  public A addToPhysicalDisks(Integer index,RootDeviceHints item) {
    if (this.physicalDisks == null) {this.physicalDisks = new ArrayList();}
    RootDeviceHintsBuilder builder = new RootDeviceHintsBuilder(item);_visitables.get("physicalDisks").add(index >= 0 ? index : _visitables.get("physicalDisks").size(), builder);this.physicalDisks.add(index >= 0 ? index : physicalDisks.size(), builder); return (A)this;
  }
  public A setToPhysicalDisks(Integer index,RootDeviceHints item) {
    if (this.physicalDisks == null) {this.physicalDisks = new ArrayList();}
    RootDeviceHintsBuilder builder = new RootDeviceHintsBuilder(item);
    if (index < 0 || index >= _visitables.get("physicalDisks").size()) { _visitables.get("physicalDisks").add(builder); } else { _visitables.get("physicalDisks").set(index, builder);}
    if (index < 0 || index >= physicalDisks.size()) { physicalDisks.add(builder); } else { physicalDisks.set(index, builder);}
     return (A)this;
  }
  public A addToPhysicalDisks(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.RootDeviceHints... items) {
    if (this.physicalDisks == null) {this.physicalDisks = new ArrayList();}
    for (RootDeviceHints item : items) {RootDeviceHintsBuilder builder = new RootDeviceHintsBuilder(item);_visitables.get("physicalDisks").add(builder);this.physicalDisks.add(builder);} return (A)this;
  }
  public A addAllToPhysicalDisks(Collection items) {
    if (this.physicalDisks == null) {this.physicalDisks = new ArrayList();}
    for (RootDeviceHints item : items) {RootDeviceHintsBuilder builder = new RootDeviceHintsBuilder(item);_visitables.get("physicalDisks").add(builder);this.physicalDisks.add(builder);} return (A)this;
  }
  public A removeFromPhysicalDisks(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.RootDeviceHints... items) {
    for (RootDeviceHints item : items) {RootDeviceHintsBuilder builder = new RootDeviceHintsBuilder(item);_visitables.get("physicalDisks").remove(builder);if (this.physicalDisks != null) {this.physicalDisks.remove(builder);}} return (A)this;
  }
  public A removeAllFromPhysicalDisks(Collection items) {
    for (RootDeviceHints item : items) {RootDeviceHintsBuilder builder = new RootDeviceHintsBuilder(item);_visitables.get("physicalDisks").remove(builder);if (this.physicalDisks != null) {this.physicalDisks.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromPhysicalDisks(Predicate predicate) {
    if (physicalDisks == null) return (A) this;
    final Iterator each = physicalDisks.iterator();
    final List visitables = _visitables.get("physicalDisks");
    while (each.hasNext()) {
      RootDeviceHintsBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildPhysicalDisks instead.
   * @return The buildable object.
   */
  @Deprecated
  public List getPhysicalDisks() {
    return physicalDisks != null ? build(physicalDisks) : null;
  }
  public List buildPhysicalDisks() {
    return physicalDisks != null ? build(physicalDisks) : null;
  }
  public RootDeviceHints buildPhysicalDisk(Integer index) {
    return this.physicalDisks.get(index).build();
  }
  public RootDeviceHints buildFirstPhysicalDisk() {
    return this.physicalDisks.get(0).build();
  }
  public RootDeviceHints buildLastPhysicalDisk() {
    return this.physicalDisks.get(physicalDisks.size() - 1).build();
  }
  public RootDeviceHints buildMatchingPhysicalDisk(Predicate predicate) {
    for (RootDeviceHintsBuilder item: physicalDisks) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public Boolean hasMatchingPhysicalDisk(Predicate predicate) {
    for (RootDeviceHintsBuilder item: physicalDisks) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withPhysicalDisks(List physicalDisks) {
    if (this.physicalDisks != null) { _visitables.get("physicalDisks").removeAll(this.physicalDisks);}
    if (physicalDisks != null) {this.physicalDisks = new ArrayList(); for (RootDeviceHints item : physicalDisks){this.addToPhysicalDisks(item);}} else { this.physicalDisks = null;} return (A) this;
  }
  public A withPhysicalDisks(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.RootDeviceHints... physicalDisks) {
    if (this.physicalDisks != null) {this.physicalDisks.clear();}
    if (physicalDisks != null) {for (RootDeviceHints item :physicalDisks){ this.addToPhysicalDisks(item);}} return (A) this;
  }
  public Boolean hasPhysicalDisks() {
    return physicalDisks != null && !physicalDisks.isEmpty();
  }
  public SoftwareRAIDVolumeFluent.PhysicalDisksNested addNewPhysicalDisk() {
    return new SoftwareRAIDVolumeFluentImpl.PhysicalDisksNestedImpl();
  }
  public SoftwareRAIDVolumeFluent.PhysicalDisksNested addNewPhysicalDiskLike(RootDeviceHints item) {
    return new SoftwareRAIDVolumeFluentImpl.PhysicalDisksNestedImpl(-1, item);
  }
  public SoftwareRAIDVolumeFluent.PhysicalDisksNested setNewPhysicalDiskLike(Integer index,RootDeviceHints item) {
    return new SoftwareRAIDVolumeFluentImpl.PhysicalDisksNestedImpl(index, item);
  }
  public SoftwareRAIDVolumeFluent.PhysicalDisksNested editPhysicalDisk(Integer index) {
    if (physicalDisks.size() <= index) throw new RuntimeException("Can't edit physicalDisks. Index exceeds size.");
    return setNewPhysicalDiskLike(index, buildPhysicalDisk(index));
  }
  public SoftwareRAIDVolumeFluent.PhysicalDisksNested editFirstPhysicalDisk() {
    if (physicalDisks.size() == 0) throw new RuntimeException("Can't edit first physicalDisks. The list is empty.");
    return setNewPhysicalDiskLike(0, buildPhysicalDisk(0));
  }
  public SoftwareRAIDVolumeFluent.PhysicalDisksNested editLastPhysicalDisk() {
    int index = physicalDisks.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last physicalDisks. The list is empty.");
    return setNewPhysicalDiskLike(index, buildPhysicalDisk(index));
  }
  public SoftwareRAIDVolumeFluent.PhysicalDisksNested editMatchingPhysicalDisk(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;
    SoftwareRAIDVolumeFluentImpl that = (SoftwareRAIDVolumeFluentImpl) o;
    if (level != null ? !level.equals(that.level) :that.level != null) return false;
    if (physicalDisks != null ? !physicalDisks.equals(that.physicalDisks) :that.physicalDisks != null) return false;
    if (sizeGibibytes != null ? !sizeGibibytes.equals(that.sizeGibibytes) :that.sizeGibibytes != 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(level,  physicalDisks,  sizeGibibytes,  additionalProperties,  super.hashCode());
  }
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (level != null) { sb.append("level:"); sb.append(level + ","); }
    if (physicalDisks != null && !physicalDisks.isEmpty()) { sb.append("physicalDisks:"); sb.append(physicalDisks + ","); }
    if (sizeGibibytes != null) { sb.append("sizeGibibytes:"); sb.append(sizeGibibytes + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  class PhysicalDisksNestedImpl extends RootDeviceHintsFluentImpl> implements SoftwareRAIDVolumeFluent.PhysicalDisksNested,Nested{
    PhysicalDisksNestedImpl(Integer index,RootDeviceHints item) {
      this.index = index;
      this.builder = new RootDeviceHintsBuilder(this, item);
    }
    PhysicalDisksNestedImpl() {
      this.index = -1;
      this.builder = new RootDeviceHintsBuilder(this);
    }
    RootDeviceHintsBuilder builder;
    Integer index;
    public N and() {
      return (N) SoftwareRAIDVolumeFluentImpl.this.setToPhysicalDisks(index,builder.build());
    }
    public N endPhysicalDisk() {
      return and();
    }
    
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy