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

io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.NICFluentImpl 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.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 NICFluentImpl> extends BaseFluent implements NICFluent{
  public NICFluentImpl() {
  }
  public NICFluentImpl(NIC instance) {
    if (instance != null) {
      this.withIp(instance.getIp());
      this.withMac(instance.getMac());
      this.withModel(instance.getModel());
      this.withName(instance.getName());
      this.withPxe(instance.getPxe());
      this.withSpeedGbps(instance.getSpeedGbps());
      this.withVlanId(instance.getVlanId());
      this.withVlans(instance.getVlans());
      this.withAdditionalProperties(instance.getAdditionalProperties());
    }
  }
  private String ip;
  private String mac;
  private String model;
  private String name;
  private Boolean pxe;
  private Integer speedGbps;
  private Integer vlanId;
  private ArrayList vlans = new ArrayList();
  private Map additionalProperties;
  public String getIp() {
    return this.ip;
  }
  public A withIp(String ip) {
    this.ip=ip; return (A) this;
  }
  public Boolean hasIp() {
    return this.ip != null;
  }
  public String getMac() {
    return this.mac;
  }
  public A withMac(String mac) {
    this.mac=mac; return (A) this;
  }
  public Boolean hasMac() {
    return this.mac != null;
  }
  public String getModel() {
    return this.model;
  }
  public A withModel(String model) {
    this.model=model; return (A) this;
  }
  public Boolean hasModel() {
    return this.model != null;
  }
  public String getName() {
    return this.name;
  }
  public A withName(String name) {
    this.name=name; return (A) this;
  }
  public Boolean hasName() {
    return this.name != null;
  }
  public Boolean getPxe() {
    return this.pxe;
  }
  public A withPxe(Boolean pxe) {
    this.pxe=pxe; return (A) this;
  }
  public Boolean hasPxe() {
    return this.pxe != null;
  }
  public Integer getSpeedGbps() {
    return this.speedGbps;
  }
  public A withSpeedGbps(Integer speedGbps) {
    this.speedGbps=speedGbps; return (A) this;
  }
  public Boolean hasSpeedGbps() {
    return this.speedGbps != null;
  }
  public Integer getVlanId() {
    return this.vlanId;
  }
  public A withVlanId(Integer vlanId) {
    this.vlanId=vlanId; return (A) this;
  }
  public Boolean hasVlanId() {
    return this.vlanId != null;
  }
  public A addToVlans(int index,VLAN item) {
    if (this.vlans == null) {this.vlans = new ArrayList();}
    VLANBuilder builder = new VLANBuilder(item);
    if (index < 0 || index >= vlans.size()) { _visitables.get("vlans").add(builder); vlans.add(builder); } else { _visitables.get("vlans").add(index, builder); vlans.add(index, builder);}
    return (A)this;
  }
  public A setToVlans(int index,VLAN item) {
    if (this.vlans == null) {this.vlans = new ArrayList();}
    VLANBuilder builder = new VLANBuilder(item);
    if (index < 0 || index >= vlans.size()) { _visitables.get("vlans").add(builder); vlans.add(builder); } else { _visitables.get("vlans").set(index, builder); vlans.set(index, builder);}
    return (A)this;
  }
  public A addToVlans(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.VLAN... items) {
    if (this.vlans == null) {this.vlans = new ArrayList();}
    for (VLAN item : items) {VLANBuilder builder = new VLANBuilder(item);_visitables.get("vlans").add(builder);this.vlans.add(builder);} return (A)this;
  }
  public A addAllToVlans(Collection items) {
    if (this.vlans == null) {this.vlans = new ArrayList();}
    for (VLAN item : items) {VLANBuilder builder = new VLANBuilder(item);_visitables.get("vlans").add(builder);this.vlans.add(builder);} return (A)this;
  }
  public A removeFromVlans(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.VLAN... items) {
    for (VLAN item : items) {VLANBuilder builder = new VLANBuilder(item);_visitables.get("vlans").remove(builder);if (this.vlans != null) {this.vlans.remove(builder);}} return (A)this;
  }
  public A removeAllFromVlans(Collection items) {
    for (VLAN item : items) {VLANBuilder builder = new VLANBuilder(item);_visitables.get("vlans").remove(builder);if (this.vlans != null) {this.vlans.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromVlans(Predicate predicate) {
    if (vlans == null) return (A) this;
    final Iterator each = vlans.iterator();
    final List visitables = _visitables.get("vlans");
    while (each.hasNext()) {
      VLANBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildVlans instead.
   * @return The buildable object.
   */
  @Deprecated
  public List getVlans() {
    return vlans != null ? build(vlans) : null;
  }
  public List buildVlans() {
    return vlans != null ? build(vlans) : null;
  }
  public VLAN buildVlan(int index) {
    return this.vlans.get(index).build();
  }
  public VLAN buildFirstVlan() {
    return this.vlans.get(0).build();
  }
  public VLAN buildLastVlan() {
    return this.vlans.get(vlans.size() - 1).build();
  }
  public VLAN buildMatchingVlan(Predicate predicate) {
    for (VLANBuilder item: vlans) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public Boolean hasMatchingVlan(Predicate predicate) {
    for (VLANBuilder item: vlans) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withVlans(List vlans) {
    if (this.vlans != null) { _visitables.get("vlans").clear();}
    if (vlans != null) {this.vlans = new ArrayList(); for (VLAN item : vlans){this.addToVlans(item);}} else { this.vlans = null;} return (A) this;
  }
  public A withVlans(io.fabric8.openshift.api.model.miscellaneous.metal3.v1alpha1.VLAN... vlans) {
    if (this.vlans != null) {this.vlans.clear(); _visitables.remove("vlans"); }
    if (vlans != null) {for (VLAN item :vlans){ this.addToVlans(item);}} return (A) this;
  }
  public Boolean hasVlans() {
    return vlans != null && !vlans.isEmpty();
  }
  public A addNewVlan(Integer id,String name) {
    return (A)addToVlans(new VLAN(id, name));
  }
  public NICFluentImpl.VlansNested addNewVlan() {
    return new NICFluentImpl.VlansNestedImpl();
  }
  public NICFluentImpl.VlansNested addNewVlanLike(VLAN item) {
    return new NICFluentImpl.VlansNestedImpl(-1, item);
  }
  public NICFluentImpl.VlansNested setNewVlanLike(int index,VLAN item) {
    return new NICFluentImpl.VlansNestedImpl(index, item);
  }
  public NICFluentImpl.VlansNested editVlan(int index) {
    if (vlans.size() <= index) throw new RuntimeException("Can't edit vlans. Index exceeds size.");
    return setNewVlanLike(index, buildVlan(index));
  }
  public NICFluentImpl.VlansNested editFirstVlan() {
    if (vlans.size() == 0) throw new RuntimeException("Can't edit first vlans. The list is empty.");
    return setNewVlanLike(0, buildVlan(0));
  }
  public NICFluentImpl.VlansNested editLastVlan() {
    int index = vlans.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last vlans. The list is empty.");
    return setNewVlanLike(index, buildVlan(index));
  }
  public NICFluentImpl.VlansNested editMatchingVlan(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;
    NICFluentImpl that = (NICFluentImpl) o;
    if (!java.util.Objects.equals(ip, that.ip)) return false;

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

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

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

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

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

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

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

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

    return true;
  }
  public int hashCode() {
    return java.util.Objects.hash(ip,  mac,  model,  name,  pxe,  speedGbps,  vlanId,  vlans,  additionalProperties,  super.hashCode());
  }
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (ip != null) { sb.append("ip:"); sb.append(ip + ","); }
    if (mac != null) { sb.append("mac:"); sb.append(mac + ","); }
    if (model != null) { sb.append("model:"); sb.append(model + ","); }
    if (name != null) { sb.append("name:"); sb.append(name + ","); }
    if (pxe != null) { sb.append("pxe:"); sb.append(pxe + ","); }
    if (speedGbps != null) { sb.append("speedGbps:"); sb.append(speedGbps + ","); }
    if (vlanId != null) { sb.append("vlanId:"); sb.append(vlanId + ","); }
    if (vlans != null) { sb.append("vlans:"); sb.append(vlans + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public A withPxe() {
    return withPxe(true);
  }
  class VlansNestedImpl extends VLANFluentImpl> implements NICFluentImpl.VlansNested,Nested{
    VlansNestedImpl(int index,VLAN item) {
      this.index = index;
      this.builder = new VLANBuilder(this, item);
    }
    VlansNestedImpl() {
      this.index = -1;
      this.builder = new VLANBuilder(this);
    }
    VLANBuilder builder;
    int index;
    public N and() {
      return (N) NICFluentImpl.this.setToVlans(index,builder.build());
    }
    public N endVlan() {
      return and();
    }
    
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy