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

io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.HardwareDetailsFluentImpl 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 HardwareDetailsFluentImpl> extends BaseFluent implements HardwareDetailsFluent{
  public HardwareDetailsFluentImpl() {
  }
  public HardwareDetailsFluentImpl(HardwareDetails instance) {
    if (instance != null) {
      this.withCpu(instance.getCpu());
      this.withFirmware(instance.getFirmware());
      this.withHostname(instance.getHostname());
      this.withNics(instance.getNics());
      this.withRamMebibytes(instance.getRamMebibytes());
      this.withStorage(instance.getStorage());
      this.withSystemVendor(instance.getSystemVendor());
      this.withAdditionalProperties(instance.getAdditionalProperties());
    }
  }
  private CPUBuilder cpu;
  private FirmwareBuilder firmware;
  private String hostname;
  private ArrayList nics = new ArrayList();
  private Integer ramMebibytes;
  private ArrayList storage = new ArrayList();
  private HardwareSystemVendorBuilder systemVendor;
  private Map additionalProperties;
  
  /**
   * This method has been deprecated, please use method buildCpu instead.
   * @return The buildable object.
   */
  @Deprecated
  public CPU getCpu() {
    return this.cpu!=null ?this.cpu.build():null;
  }
  public CPU buildCpu() {
    return this.cpu!=null ?this.cpu.build():null;
  }
  public A withCpu(CPU cpu) {
    _visitables.get("cpu").remove(this.cpu);
    if (cpu!=null){ this.cpu= new CPUBuilder(cpu); _visitables.get("cpu").add(this.cpu);} else { this.cpu = null; _visitables.get("cpu").remove(this.cpu); } return (A) this;
  }
  public Boolean hasCpu() {
    return this.cpu != null;
  }
  public HardwareDetailsFluentImpl.CpuNested withNewCpu() {
    return new HardwareDetailsFluentImpl.CpuNestedImpl();
  }
  public HardwareDetailsFluentImpl.CpuNested withNewCpuLike(CPU item) {
    return new HardwareDetailsFluentImpl.CpuNestedImpl(item);
  }
  public HardwareDetailsFluentImpl.CpuNested editCpu() {
    return withNewCpuLike(getCpu());
  }
  public HardwareDetailsFluentImpl.CpuNested editOrNewCpu() {
    return withNewCpuLike(getCpu() != null ? getCpu(): new CPUBuilder().build());
  }
  public HardwareDetailsFluentImpl.CpuNested editOrNewCpuLike(CPU item) {
    return withNewCpuLike(getCpu() != null ? getCpu(): item);
  }
  
  /**
   * This method has been deprecated, please use method buildFirmware instead.
   * @return The buildable object.
   */
  @Deprecated
  public Firmware getFirmware() {
    return this.firmware!=null ?this.firmware.build():null;
  }
  public Firmware buildFirmware() {
    return this.firmware!=null ?this.firmware.build():null;
  }
  public A withFirmware(Firmware firmware) {
    _visitables.get("firmware").remove(this.firmware);
    if (firmware!=null){ this.firmware= new FirmwareBuilder(firmware); _visitables.get("firmware").add(this.firmware);} else { this.firmware = null; _visitables.get("firmware").remove(this.firmware); } return (A) this;
  }
  public Boolean hasFirmware() {
    return this.firmware != null;
  }
  public HardwareDetailsFluentImpl.FirmwareNested withNewFirmware() {
    return new HardwareDetailsFluentImpl.FirmwareNestedImpl();
  }
  public HardwareDetailsFluentImpl.FirmwareNested withNewFirmwareLike(Firmware item) {
    return new HardwareDetailsFluentImpl.FirmwareNestedImpl(item);
  }
  public HardwareDetailsFluentImpl.FirmwareNested editFirmware() {
    return withNewFirmwareLike(getFirmware());
  }
  public HardwareDetailsFluentImpl.FirmwareNested editOrNewFirmware() {
    return withNewFirmwareLike(getFirmware() != null ? getFirmware(): new FirmwareBuilder().build());
  }
  public HardwareDetailsFluentImpl.FirmwareNested editOrNewFirmwareLike(Firmware item) {
    return withNewFirmwareLike(getFirmware() != null ? getFirmware(): item);
  }
  public String getHostname() {
    return this.hostname;
  }
  public A withHostname(String hostname) {
    this.hostname=hostname; return (A) this;
  }
  public Boolean hasHostname() {
    return this.hostname != null;
  }
  public A addToNics(int index,NIC item) {
    if (this.nics == null) {this.nics = new ArrayList();}
    NICBuilder builder = new NICBuilder(item);
    if (index < 0 || index >= nics.size()) { _visitables.get("nics").add(builder); nics.add(builder); } else { _visitables.get("nics").add(index, builder); nics.add(index, builder);}
    return (A)this;
  }
  public A setToNics(int index,NIC item) {
    if (this.nics == null) {this.nics = new ArrayList();}
    NICBuilder builder = new NICBuilder(item);
    if (index < 0 || index >= nics.size()) { _visitables.get("nics").add(builder); nics.add(builder); } else { _visitables.get("nics").set(index, builder); nics.set(index, builder);}
    return (A)this;
  }
  public A addToNics(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.NIC... items) {
    if (this.nics == null) {this.nics = new ArrayList();}
    for (NIC item : items) {NICBuilder builder = new NICBuilder(item);_visitables.get("nics").add(builder);this.nics.add(builder);} return (A)this;
  }
  public A addAllToNics(Collection items) {
    if (this.nics == null) {this.nics = new ArrayList();}
    for (NIC item : items) {NICBuilder builder = new NICBuilder(item);_visitables.get("nics").add(builder);this.nics.add(builder);} return (A)this;
  }
  public A removeFromNics(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.NIC... items) {
    for (NIC item : items) {NICBuilder builder = new NICBuilder(item);_visitables.get("nics").remove(builder);if (this.nics != null) {this.nics.remove(builder);}} return (A)this;
  }
  public A removeAllFromNics(Collection items) {
    for (NIC item : items) {NICBuilder builder = new NICBuilder(item);_visitables.get("nics").remove(builder);if (this.nics != null) {this.nics.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromNics(Predicate predicate) {
    if (nics == null) return (A) this;
    final Iterator each = nics.iterator();
    final List visitables = _visitables.get("nics");
    while (each.hasNext()) {
      NICBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildNics instead.
   * @return The buildable object.
   */
  @Deprecated
  public List getNics() {
    return nics != null ? build(nics) : null;
  }
  public List buildNics() {
    return nics != null ? build(nics) : null;
  }
  public NIC buildNic(int index) {
    return this.nics.get(index).build();
  }
  public NIC buildFirstNic() {
    return this.nics.get(0).build();
  }
  public NIC buildLastNic() {
    return this.nics.get(nics.size() - 1).build();
  }
  public NIC buildMatchingNic(Predicate predicate) {
    for (NICBuilder item: nics) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public Boolean hasMatchingNic(Predicate predicate) {
    for (NICBuilder item: nics) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withNics(List nics) {
    if (this.nics != null) { _visitables.get("nics").clear();}
    if (nics != null) {this.nics = new ArrayList(); for (NIC item : nics){this.addToNics(item);}} else { this.nics = null;} return (A) this;
  }
  public A withNics(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.NIC... nics) {
    if (this.nics != null) {this.nics.clear(); _visitables.remove("nics"); }
    if (nics != null) {for (NIC item :nics){ this.addToNics(item);}} return (A) this;
  }
  public Boolean hasNics() {
    return nics != null && !nics.isEmpty();
  }
  public HardwareDetailsFluentImpl.NicsNested addNewNic() {
    return new HardwareDetailsFluentImpl.NicsNestedImpl();
  }
  public HardwareDetailsFluentImpl.NicsNested addNewNicLike(NIC item) {
    return new HardwareDetailsFluentImpl.NicsNestedImpl(-1, item);
  }
  public HardwareDetailsFluentImpl.NicsNested setNewNicLike(int index,NIC item) {
    return new HardwareDetailsFluentImpl.NicsNestedImpl(index, item);
  }
  public HardwareDetailsFluentImpl.NicsNested editNic(int index) {
    if (nics.size() <= index) throw new RuntimeException("Can't edit nics. Index exceeds size.");
    return setNewNicLike(index, buildNic(index));
  }
  public HardwareDetailsFluentImpl.NicsNested editFirstNic() {
    if (nics.size() == 0) throw new RuntimeException("Can't edit first nics. The list is empty.");
    return setNewNicLike(0, buildNic(0));
  }
  public HardwareDetailsFluentImpl.NicsNested editLastNic() {
    int index = nics.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last nics. The list is empty.");
    return setNewNicLike(index, buildNic(index));
  }
  public HardwareDetailsFluentImpl.NicsNested editMatchingNic(Predicate predicate) {
    int index = -1;
    for (int i=0;i();}
    StorageBuilder builder = new StorageBuilder(item);
    if (index < 0 || index >= storage.size()) { _visitables.get("storage").add(builder); storage.add(builder); } else { _visitables.get("storage").add(index, builder); storage.add(index, builder);}
    return (A)this;
  }
  public A setToStorage(int index,Storage item) {
    if (this.storage == null) {this.storage = new ArrayList();}
    StorageBuilder builder = new StorageBuilder(item);
    if (index < 0 || index >= storage.size()) { _visitables.get("storage").add(builder); storage.add(builder); } else { _visitables.get("storage").set(index, builder); storage.set(index, builder);}
    return (A)this;
  }
  public A addToStorage(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.Storage... items) {
    if (this.storage == null) {this.storage = new ArrayList();}
    for (Storage item : items) {StorageBuilder builder = new StorageBuilder(item);_visitables.get("storage").add(builder);this.storage.add(builder);} return (A)this;
  }
  public A addAllToStorage(Collection items) {
    if (this.storage == null) {this.storage = new ArrayList();}
    for (Storage item : items) {StorageBuilder builder = new StorageBuilder(item);_visitables.get("storage").add(builder);this.storage.add(builder);} return (A)this;
  }
  public A removeFromStorage(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.Storage... items) {
    for (Storage item : items) {StorageBuilder builder = new StorageBuilder(item);_visitables.get("storage").remove(builder);if (this.storage != null) {this.storage.remove(builder);}} return (A)this;
  }
  public A removeAllFromStorage(Collection items) {
    for (Storage item : items) {StorageBuilder builder = new StorageBuilder(item);_visitables.get("storage").remove(builder);if (this.storage != null) {this.storage.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromStorage(Predicate predicate) {
    if (storage == null) return (A) this;
    final Iterator each = storage.iterator();
    final List visitables = _visitables.get("storage");
    while (each.hasNext()) {
      StorageBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildStorage instead.
   * @return The buildable object.
   */
  @Deprecated
  public List getStorage() {
    return storage != null ? build(storage) : null;
  }
  public List buildStorage() {
    return storage != null ? build(storage) : null;
  }
  public Storage buildStorage(int index) {
    return this.storage.get(index).build();
  }
  public Storage buildFirstStorage() {
    return this.storage.get(0).build();
  }
  public Storage buildLastStorage() {
    return this.storage.get(storage.size() - 1).build();
  }
  public Storage buildMatchingStorage(Predicate predicate) {
    for (StorageBuilder item: storage) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public Boolean hasMatchingStorage(Predicate predicate) {
    for (StorageBuilder item: storage) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withStorage(List storage) {
    if (this.storage != null) { _visitables.get("storage").clear();}
    if (storage != null) {this.storage = new ArrayList(); for (Storage item : storage){this.addToStorage(item);}} else { this.storage = null;} return (A) this;
  }
  public A withStorage(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.Storage... storage) {
    if (this.storage != null) {this.storage.clear(); _visitables.remove("storage"); }
    if (storage != null) {for (Storage item :storage){ this.addToStorage(item);}} return (A) this;
  }
  public Boolean hasStorage() {
    return storage != null && !storage.isEmpty();
  }
  public HardwareDetailsFluentImpl.StorageNested addNewStorage() {
    return new HardwareDetailsFluentImpl.StorageNestedImpl();
  }
  public HardwareDetailsFluentImpl.StorageNested addNewStorageLike(Storage item) {
    return new HardwareDetailsFluentImpl.StorageNestedImpl(-1, item);
  }
  public HardwareDetailsFluentImpl.StorageNested setNewStorageLike(int index,Storage item) {
    return new HardwareDetailsFluentImpl.StorageNestedImpl(index, item);
  }
  public HardwareDetailsFluentImpl.StorageNested editStorage(int index) {
    if (storage.size() <= index) throw new RuntimeException("Can't edit storage. Index exceeds size.");
    return setNewStorageLike(index, buildStorage(index));
  }
  public HardwareDetailsFluentImpl.StorageNested editFirstStorage() {
    if (storage.size() == 0) throw new RuntimeException("Can't edit first storage. The list is empty.");
    return setNewStorageLike(0, buildStorage(0));
  }
  public HardwareDetailsFluentImpl.StorageNested editLastStorage() {
    int index = storage.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last storage. The list is empty.");
    return setNewStorageLike(index, buildStorage(index));
  }
  public HardwareDetailsFluentImpl.StorageNested editMatchingStorage(Predicate predicate) {
    int index = -1;
    for (int i=0;i withNewSystemVendor() {
    return new HardwareDetailsFluentImpl.SystemVendorNestedImpl();
  }
  public HardwareDetailsFluentImpl.SystemVendorNested withNewSystemVendorLike(HardwareSystemVendor item) {
    return new HardwareDetailsFluentImpl.SystemVendorNestedImpl(item);
  }
  public HardwareDetailsFluentImpl.SystemVendorNested editSystemVendor() {
    return withNewSystemVendorLike(getSystemVendor());
  }
  public HardwareDetailsFluentImpl.SystemVendorNested editOrNewSystemVendor() {
    return withNewSystemVendorLike(getSystemVendor() != null ? getSystemVendor(): new HardwareSystemVendorBuilder().build());
  }
  public HardwareDetailsFluentImpl.SystemVendorNested editOrNewSystemVendorLike(HardwareSystemVendor item) {
    return withNewSystemVendorLike(getSystemVendor() != null ? getSystemVendor(): item);
  }
  public A addToAdditionalProperties(String key,Object value) {
    if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new LinkedHashMap(); }
    if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
  }
  public A addToAdditionalProperties(Map 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;
    HardwareDetailsFluentImpl that = (HardwareDetailsFluentImpl) o;
    if (!java.util.Objects.equals(cpu, that.cpu)) return false;

    if (!java.util.Objects.equals(firmware, that.firmware)) return false;

    if (!java.util.Objects.equals(hostname, that.hostname)) return false;

    if (!java.util.Objects.equals(nics, that.nics)) return false;

    if (!java.util.Objects.equals(ramMebibytes, that.ramMebibytes)) return false;

    if (!java.util.Objects.equals(storage, that.storage)) return false;

    if (!java.util.Objects.equals(systemVendor, that.systemVendor)) return false;

    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;

    return true;
  }
  public int hashCode() {
    return java.util.Objects.hash(cpu,  firmware,  hostname,  nics,  ramMebibytes,  storage,  systemVendor,  additionalProperties,  super.hashCode());
  }
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (cpu != null) { sb.append("cpu:"); sb.append(cpu + ","); }
    if (firmware != null) { sb.append("firmware:"); sb.append(firmware + ","); }
    if (hostname != null) { sb.append("hostname:"); sb.append(hostname + ","); }
    if (nics != null) { sb.append("nics:"); sb.append(nics + ","); }
    if (ramMebibytes != null) { sb.append("ramMebibytes:"); sb.append(ramMebibytes + ","); }
    if (storage != null) { sb.append("storage:"); sb.append(storage + ","); }
    if (systemVendor != null) { sb.append("systemVendor:"); sb.append(systemVendor + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  class CpuNestedImpl extends CPUFluentImpl> implements HardwareDetailsFluentImpl.CpuNested,Nested{
    CpuNestedImpl(CPU item) {
      this.builder = new CPUBuilder(this, item);
    }
    CpuNestedImpl() {
      this.builder = new CPUBuilder(this);
    }
    CPUBuilder builder;
    public N and() {
      return (N) HardwareDetailsFluentImpl.this.withCpu(builder.build());
    }
    public N endCpu() {
      return and();
    }
    
  }
  class FirmwareNestedImpl extends FirmwareFluentImpl> implements HardwareDetailsFluentImpl.FirmwareNested,Nested{
    FirmwareNestedImpl(Firmware item) {
      this.builder = new FirmwareBuilder(this, item);
    }
    FirmwareNestedImpl() {
      this.builder = new FirmwareBuilder(this);
    }
    FirmwareBuilder builder;
    public N and() {
      return (N) HardwareDetailsFluentImpl.this.withFirmware(builder.build());
    }
    public N endFirmware() {
      return and();
    }
    
  }
  class NicsNestedImpl extends NICFluentImpl> implements HardwareDetailsFluentImpl.NicsNested,Nested{
    NicsNestedImpl(int index,NIC item) {
      this.index = index;
      this.builder = new NICBuilder(this, item);
    }
    NicsNestedImpl() {
      this.index = -1;
      this.builder = new NICBuilder(this);
    }
    NICBuilder builder;
    int index;
    public N and() {
      return (N) HardwareDetailsFluentImpl.this.setToNics(index,builder.build());
    }
    public N endNic() {
      return and();
    }
    
  }
  class StorageNestedImpl extends StorageFluentImpl> implements HardwareDetailsFluentImpl.StorageNested,Nested{
    StorageNestedImpl(int index,Storage item) {
      this.index = index;
      this.builder = new StorageBuilder(this, item);
    }
    StorageNestedImpl() {
      this.index = -1;
      this.builder = new StorageBuilder(this);
    }
    StorageBuilder builder;
    int index;
    public N and() {
      return (N) HardwareDetailsFluentImpl.this.setToStorage(index,builder.build());
    }
    public N endStorage() {
      return and();
    }
    
  }
  class SystemVendorNestedImpl extends HardwareSystemVendorFluentImpl> implements HardwareDetailsFluentImpl.SystemVendorNested,Nested{
    SystemVendorNestedImpl(HardwareSystemVendor item) {
      this.builder = new HardwareSystemVendorBuilder(this, item);
    }
    SystemVendorNestedImpl() {
      this.builder = new HardwareSystemVendorBuilder(this);
    }
    HardwareSystemVendorBuilder builder;
    public N and() {
      return (N) HardwareDetailsFluentImpl.this.withSystemVendor(builder.build());
    }
    public N endSystemVendor() {
      return and();
    }
    
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy