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

io.kubernetes.client.openapi.models.V1EndpointHintsFluent Maven / Gradle / Ivy

There is a newer version: 22.0.0
Show newest version
package io.kubernetes.client.openapi.models;

import io.kubernetes.client.fluent.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.function.Predicate;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class V1EndpointHintsFluent> extends BaseFluent{
  public V1EndpointHintsFluent() {
  }
  
  public V1EndpointHintsFluent(V1EndpointHints instance) {
    this.copyInstance(instance);
  }
  private ArrayList forZones;
  
  protected void copyInstance(V1EndpointHints instance) {
    instance = (instance != null ? instance : new V1EndpointHints());
    if (instance != null) {
          this.withForZones(instance.getForZones());
        }
  }
  
  public A addToForZones(int index,V1ForZone item) {
    if (this.forZones == null) {this.forZones = new ArrayList();}
    V1ForZoneBuilder builder = new V1ForZoneBuilder(item);
    if (index < 0 || index >= forZones.size()) { _visitables.get("forZones").add(builder); forZones.add(builder); } else { _visitables.get("forZones").add(index, builder); forZones.add(index, builder);}
    return (A)this;
  }
  
  public A setToForZones(int index,V1ForZone item) {
    if (this.forZones == null) {this.forZones = new ArrayList();}
    V1ForZoneBuilder builder = new V1ForZoneBuilder(item);
    if (index < 0 || index >= forZones.size()) { _visitables.get("forZones").add(builder); forZones.add(builder); } else { _visitables.get("forZones").set(index, builder); forZones.set(index, builder);}
    return (A)this;
  }
  
  public A addToForZones(io.kubernetes.client.openapi.models.V1ForZone... items) {
    if (this.forZones == null) {this.forZones = new ArrayList();}
    for (V1ForZone item : items) {V1ForZoneBuilder builder = new V1ForZoneBuilder(item);_visitables.get("forZones").add(builder);this.forZones.add(builder);} return (A)this;
  }
  
  public A addAllToForZones(Collection items) {
    if (this.forZones == null) {this.forZones = new ArrayList();}
    for (V1ForZone item : items) {V1ForZoneBuilder builder = new V1ForZoneBuilder(item);_visitables.get("forZones").add(builder);this.forZones.add(builder);} return (A)this;
  }
  
  public A removeFromForZones(io.kubernetes.client.openapi.models.V1ForZone... items) {
    if (this.forZones == null) return (A)this;
    for (V1ForZone item : items) {V1ForZoneBuilder builder = new V1ForZoneBuilder(item);_visitables.get("forZones").remove(builder); this.forZones.remove(builder);} return (A)this;
  }
  
  public A removeAllFromForZones(Collection items) {
    if (this.forZones == null) return (A)this;
    for (V1ForZone item : items) {V1ForZoneBuilder builder = new V1ForZoneBuilder(item);_visitables.get("forZones").remove(builder); this.forZones.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromForZones(Predicate predicate) {
    if (forZones == null) return (A) this;
    final Iterator each = forZones.iterator();
    final List visitables = _visitables.get("forZones");
    while (each.hasNext()) {
      V1ForZoneBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildForZones() {
    return this.forZones != null ? build(forZones) : null;
  }
  
  public V1ForZone buildForZone(int index) {
    return this.forZones.get(index).build();
  }
  
  public V1ForZone buildFirstForZone() {
    return this.forZones.get(0).build();
  }
  
  public V1ForZone buildLastForZone() {
    return this.forZones.get(forZones.size() - 1).build();
  }
  
  public V1ForZone buildMatchingForZone(Predicate predicate) {
      for (V1ForZoneBuilder item : forZones) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingForZone(Predicate predicate) {
      for (V1ForZoneBuilder item : forZones) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withForZones(List forZones) {
    if (this.forZones != null) {
      this._visitables.get("forZones").clear();
    }
    if (forZones != null) {
        this.forZones = new ArrayList();
        for (V1ForZone item : forZones) {
          this.addToForZones(item);
        }
    } else {
      this.forZones = null;
    }
    return (A) this;
  }
  
  public A withForZones(io.kubernetes.client.openapi.models.V1ForZone... forZones) {
    if (this.forZones != null) {
        this.forZones.clear();
        _visitables.remove("forZones");
    }
    if (forZones != null) {
      for (V1ForZone item : forZones) {
        this.addToForZones(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasForZones() {
    return this.forZones != null && !this.forZones.isEmpty();
  }
  
  public ForZonesNested addNewForZone() {
    return new ForZonesNested(-1, null);
  }
  
  public ForZonesNested addNewForZoneLike(V1ForZone item) {
    return new ForZonesNested(-1, item);
  }
  
  public ForZonesNested setNewForZoneLike(int index,V1ForZone item) {
    return new ForZonesNested(index, item);
  }
  
  public ForZonesNested editForZone(int index) {
    if (forZones.size() <= index) throw new RuntimeException("Can't edit forZones. Index exceeds size.");
    return setNewForZoneLike(index, buildForZone(index));
  }
  
  public ForZonesNested editFirstForZone() {
    if (forZones.size() == 0) throw new RuntimeException("Can't edit first forZones. The list is empty.");
    return setNewForZoneLike(0, buildForZone(0));
  }
  
  public ForZonesNested editLastForZone() {
    int index = forZones.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last forZones. The list is empty.");
    return setNewForZoneLike(index, buildForZone(index));
  }
  
  public ForZonesNested editMatchingForZone(Predicate predicate) {
    int index = -1;
    for (int i=0;i extends V1ForZoneFluent> implements Nested{
    ForZonesNested(int index,V1ForZone item) {
      this.index = index;
      this.builder = new V1ForZoneBuilder(this, item);
    }
    V1ForZoneBuilder builder;
    int index;
    
    public N and() {
      return (N) V1EndpointHintsFluent.this.setToForZones(index,builder.build());
    }
    
    public N endForZone() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy