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

io.fabric8.kubernetes.api.model.storage.CSINodeDriverFluent Maven / Gradle / Ivy

The newest version!
package io.fabric8.kubernetes.api.model.storage;

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 io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.util.Map;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class CSINodeDriverFluent> extends BaseFluent{
  public CSINodeDriverFluent() {
  }
  
  public CSINodeDriverFluent(CSINodeDriver instance) {
    this.copyInstance(instance);
  }
  private VolumeNodeResourcesBuilder allocatable;
  private String name;
  private String nodeID;
  private List topologyKeys = new ArrayList();
  private Map additionalProperties;
  
  protected void copyInstance(CSINodeDriver instance) {
    instance = (instance != null ? instance : new CSINodeDriver());
    if (instance != null) {
          this.withAllocatable(instance.getAllocatable());
          this.withName(instance.getName());
          this.withNodeID(instance.getNodeID());
          this.withTopologyKeys(instance.getTopologyKeys());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  
  public VolumeNodeResources buildAllocatable() {
    return this.allocatable != null ? this.allocatable.build() : null;
  }
  
  public A withAllocatable(VolumeNodeResources allocatable) {
    this._visitables.remove("allocatable");
    if (allocatable != null) {
        this.allocatable = new VolumeNodeResourcesBuilder(allocatable);
        this._visitables.get("allocatable").add(this.allocatable);
    } else {
        this.allocatable = null;
        this._visitables.get("allocatable").remove(this.allocatable);
    }
    return (A) this;
  }
  
  public boolean hasAllocatable() {
    return this.allocatable != null;
  }
  
  public A withNewAllocatable(Integer count) {
    return (A)withAllocatable(new VolumeNodeResources(count));
  }
  
  public AllocatableNested withNewAllocatable() {
    return new AllocatableNested(null);
  }
  
  public AllocatableNested withNewAllocatableLike(VolumeNodeResources item) {
    return new AllocatableNested(item);
  }
  
  public AllocatableNested editAllocatable() {
    return withNewAllocatableLike(java.util.Optional.ofNullable(buildAllocatable()).orElse(null));
  }
  
  public AllocatableNested editOrNewAllocatable() {
    return withNewAllocatableLike(java.util.Optional.ofNullable(buildAllocatable()).orElse(new VolumeNodeResourcesBuilder().build()));
  }
  
  public AllocatableNested editOrNewAllocatableLike(VolumeNodeResources item) {
    return withNewAllocatableLike(java.util.Optional.ofNullable(buildAllocatable()).orElse(item));
  }
  
  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 String getNodeID() {
    return this.nodeID;
  }
  
  public A withNodeID(String nodeID) {
    this.nodeID = nodeID;
    return (A) this;
  }
  
  public boolean hasNodeID() {
    return this.nodeID != null;
  }
  
  public A addToTopologyKeys(int index,String item) {
    if (this.topologyKeys == null) {this.topologyKeys = new ArrayList();}
    this.topologyKeys.add(index, item);
    return (A)this;
  }
  
  public A setToTopologyKeys(int index,String item) {
    if (this.topologyKeys == null) {this.topologyKeys = new ArrayList();}
    this.topologyKeys.set(index, item); return (A)this;
  }
  
  public A addToTopologyKeys(java.lang.String... items) {
    if (this.topologyKeys == null) {this.topologyKeys = new ArrayList();}
    for (String item : items) {this.topologyKeys.add(item);} return (A)this;
  }
  
  public A addAllToTopologyKeys(Collection items) {
    if (this.topologyKeys == null) {this.topologyKeys = new ArrayList();}
    for (String item : items) {this.topologyKeys.add(item);} return (A)this;
  }
  
  public A removeFromTopologyKeys(java.lang.String... items) {
    if (this.topologyKeys == null) return (A)this;
    for (String item : items) { this.topologyKeys.remove(item);} return (A)this;
  }
  
  public A removeAllFromTopologyKeys(Collection items) {
    if (this.topologyKeys == null) return (A)this;
    for (String item : items) { this.topologyKeys.remove(item);} return (A)this;
  }
  
  public List getTopologyKeys() {
    return this.topologyKeys;
  }
  
  public String getTopologyKey(int index) {
    return this.topologyKeys.get(index);
  }
  
  public String getFirstTopologyKey() {
    return this.topologyKeys.get(0);
  }
  
  public String getLastTopologyKey() {
    return this.topologyKeys.get(topologyKeys.size() - 1);
  }
  
  public String getMatchingTopologyKey(Predicate predicate) {
      for (String item : topologyKeys) {
        if (predicate.test(item)) {
          return item;
        }
      }
      return null;
  }
  
  public boolean hasMatchingTopologyKey(Predicate predicate) {
      for (String item : topologyKeys) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withTopologyKeys(List topologyKeys) {
    if (topologyKeys != null) {
        this.topologyKeys = new ArrayList();
        for (String item : topologyKeys) {
          this.addToTopologyKeys(item);
        }
    } else {
      this.topologyKeys = null;
    }
    return (A) this;
  }
  
  public A withTopologyKeys(java.lang.String... topologyKeys) {
    if (this.topologyKeys != null) {
        this.topologyKeys.clear();
        _visitables.remove("topologyKeys");
    }
    if (topologyKeys != null) {
      for (String item : topologyKeys) {
        this.addToTopologyKeys(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasTopologyKeys() {
    return this.topologyKeys != null && !this.topologyKeys.isEmpty();
  }
  
  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;
    CSINodeDriverFluent that = (CSINodeDriverFluent) o;
    if (!java.util.Objects.equals(allocatable, that.allocatable)) return false;
    if (!java.util.Objects.equals(name, that.name)) return false;
    if (!java.util.Objects.equals(nodeID, that.nodeID)) return false;
    if (!java.util.Objects.equals(topologyKeys, that.topologyKeys)) return false;
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(allocatable,  name,  nodeID,  topologyKeys,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (allocatable != null) { sb.append("allocatable:"); sb.append(allocatable + ","); }
    if (name != null) { sb.append("name:"); sb.append(name + ","); }
    if (nodeID != null) { sb.append("nodeID:"); sb.append(nodeID + ","); }
    if (topologyKeys != null && !topologyKeys.isEmpty()) { sb.append("topologyKeys:"); sb.append(topologyKeys + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class AllocatableNested extends VolumeNodeResourcesFluent> implements Nested{
    AllocatableNested(VolumeNodeResources item) {
      this.builder = new VolumeNodeResourcesBuilder(this, item);
    }
    VolumeNodeResourcesBuilder builder;
    
    public N and() {
      return (N) CSINodeDriverFluent.this.withAllocatable(builder.build());
    }
    
    public N endAllocatable() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy