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

io.kubernetes.client.openapi.models.V1IngressLoadBalancerStatusFluent 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 V1IngressLoadBalancerStatusFluent> extends BaseFluent{
  public V1IngressLoadBalancerStatusFluent() {
  }
  
  public V1IngressLoadBalancerStatusFluent(V1IngressLoadBalancerStatus instance) {
    this.copyInstance(instance);
  }
  private ArrayList ingress;
  
  protected void copyInstance(V1IngressLoadBalancerStatus instance) {
    instance = (instance != null ? instance : new V1IngressLoadBalancerStatus());
    if (instance != null) {
          this.withIngress(instance.getIngress());
        }
  }
  
  public A addToIngress(int index,V1IngressLoadBalancerIngress item) {
    if (this.ingress == null) {this.ingress = new ArrayList();}
    V1IngressLoadBalancerIngressBuilder builder = new V1IngressLoadBalancerIngressBuilder(item);
    if (index < 0 || index >= ingress.size()) { _visitables.get("ingress").add(builder); ingress.add(builder); } else { _visitables.get("ingress").add(index, builder); ingress.add(index, builder);}
    return (A)this;
  }
  
  public A setToIngress(int index,V1IngressLoadBalancerIngress item) {
    if (this.ingress == null) {this.ingress = new ArrayList();}
    V1IngressLoadBalancerIngressBuilder builder = new V1IngressLoadBalancerIngressBuilder(item);
    if (index < 0 || index >= ingress.size()) { _visitables.get("ingress").add(builder); ingress.add(builder); } else { _visitables.get("ingress").set(index, builder); ingress.set(index, builder);}
    return (A)this;
  }
  
  public A addToIngress(io.kubernetes.client.openapi.models.V1IngressLoadBalancerIngress... items) {
    if (this.ingress == null) {this.ingress = new ArrayList();}
    for (V1IngressLoadBalancerIngress item : items) {V1IngressLoadBalancerIngressBuilder builder = new V1IngressLoadBalancerIngressBuilder(item);_visitables.get("ingress").add(builder);this.ingress.add(builder);} return (A)this;
  }
  
  public A addAllToIngress(Collection items) {
    if (this.ingress == null) {this.ingress = new ArrayList();}
    for (V1IngressLoadBalancerIngress item : items) {V1IngressLoadBalancerIngressBuilder builder = new V1IngressLoadBalancerIngressBuilder(item);_visitables.get("ingress").add(builder);this.ingress.add(builder);} return (A)this;
  }
  
  public A removeFromIngress(io.kubernetes.client.openapi.models.V1IngressLoadBalancerIngress... items) {
    if (this.ingress == null) return (A)this;
    for (V1IngressLoadBalancerIngress item : items) {V1IngressLoadBalancerIngressBuilder builder = new V1IngressLoadBalancerIngressBuilder(item);_visitables.get("ingress").remove(builder); this.ingress.remove(builder);} return (A)this;
  }
  
  public A removeAllFromIngress(Collection items) {
    if (this.ingress == null) return (A)this;
    for (V1IngressLoadBalancerIngress item : items) {V1IngressLoadBalancerIngressBuilder builder = new V1IngressLoadBalancerIngressBuilder(item);_visitables.get("ingress").remove(builder); this.ingress.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromIngress(Predicate predicate) {
    if (ingress == null) return (A) this;
    final Iterator each = ingress.iterator();
    final List visitables = _visitables.get("ingress");
    while (each.hasNext()) {
      V1IngressLoadBalancerIngressBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildIngress() {
    return this.ingress != null ? build(ingress) : null;
  }
  
  public V1IngressLoadBalancerIngress buildIngress(int index) {
    return this.ingress.get(index).build();
  }
  
  public V1IngressLoadBalancerIngress buildFirstIngress() {
    return this.ingress.get(0).build();
  }
  
  public V1IngressLoadBalancerIngress buildLastIngress() {
    return this.ingress.get(ingress.size() - 1).build();
  }
  
  public V1IngressLoadBalancerIngress buildMatchingIngress(Predicate predicate) {
      for (V1IngressLoadBalancerIngressBuilder item : ingress) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingIngress(Predicate predicate) {
      for (V1IngressLoadBalancerIngressBuilder item : ingress) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withIngress(List ingress) {
    if (this.ingress != null) {
      this._visitables.get("ingress").clear();
    }
    if (ingress != null) {
        this.ingress = new ArrayList();
        for (V1IngressLoadBalancerIngress item : ingress) {
          this.addToIngress(item);
        }
    } else {
      this.ingress = null;
    }
    return (A) this;
  }
  
  public A withIngress(io.kubernetes.client.openapi.models.V1IngressLoadBalancerIngress... ingress) {
    if (this.ingress != null) {
        this.ingress.clear();
        _visitables.remove("ingress");
    }
    if (ingress != null) {
      for (V1IngressLoadBalancerIngress item : ingress) {
        this.addToIngress(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasIngress() {
    return this.ingress != null && !this.ingress.isEmpty();
  }
  
  public IngressNested addNewIngress() {
    return new IngressNested(-1, null);
  }
  
  public IngressNested addNewIngressLike(V1IngressLoadBalancerIngress item) {
    return new IngressNested(-1, item);
  }
  
  public IngressNested setNewIngressLike(int index,V1IngressLoadBalancerIngress item) {
    return new IngressNested(index, item);
  }
  
  public IngressNested editIngress(int index) {
    if (ingress.size() <= index) throw new RuntimeException("Can't edit ingress. Index exceeds size.");
    return setNewIngressLike(index, buildIngress(index));
  }
  
  public IngressNested editFirstIngress() {
    if (ingress.size() == 0) throw new RuntimeException("Can't edit first ingress. The list is empty.");
    return setNewIngressLike(0, buildIngress(0));
  }
  
  public IngressNested editLastIngress() {
    int index = ingress.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last ingress. The list is empty.");
    return setNewIngressLike(index, buildIngress(index));
  }
  
  public IngressNested editMatchingIngress(Predicate predicate) {
    int index = -1;
    for (int i=0;i extends V1IngressLoadBalancerIngressFluent> implements Nested{
    IngressNested(int index,V1IngressLoadBalancerIngress item) {
      this.index = index;
      this.builder = new V1IngressLoadBalancerIngressBuilder(this, item);
    }
    V1IngressLoadBalancerIngressBuilder builder;
    int index;
    
    public N and() {
      return (N) V1IngressLoadBalancerStatusFluent.this.setToIngress(index,builder.build());
    }
    
    public N endIngress() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy