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

io.kubernetes.client.openapi.models.V1LoadBalancerStatusFluentImpl 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 java.lang.Integer;
import java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;

 /**
  * Generated
  */
  @SuppressWarnings(value = "unchecked")
  public class V1LoadBalancerStatusFluentImpl> extends BaseFluent implements V1LoadBalancerStatusFluent{
  public V1LoadBalancerStatusFluentImpl() {
  }
  public V1LoadBalancerStatusFluentImpl(V1LoadBalancerStatus instance) {
    this.withIngress(instance.getIngress());

  }
  private ArrayList ingress;
  public A addToIngress(Integer index,V1LoadBalancerIngress item) {
    if (this.ingress == null) {this.ingress = new ArrayList();}
    V1LoadBalancerIngressBuilder builder = new V1LoadBalancerIngressBuilder(item);_visitables.get("ingress").add(index >= 0 ? index : _visitables.get("ingress").size(), builder);this.ingress.add(index >= 0 ? index : ingress.size(), builder); return (A)this;
  }
  public A setToIngress(Integer index,V1LoadBalancerIngress item) {
    if (this.ingress == null) {this.ingress = new ArrayList();}
    V1LoadBalancerIngressBuilder builder = new V1LoadBalancerIngressBuilder(item);
    if (index < 0 || index >= _visitables.get("ingress").size()) { _visitables.get("ingress").add(builder); } else { _visitables.get("ingress").set(index, builder);}
    if (index < 0 || index >= ingress.size()) { ingress.add(builder); } else { ingress.set(index, builder);}
     return (A)this;
  }
  public A addToIngress(io.kubernetes.client.openapi.models.V1LoadBalancerIngress... items) {
    if (this.ingress == null) {this.ingress = new ArrayList();}
    for (V1LoadBalancerIngress item : items) {V1LoadBalancerIngressBuilder builder = new V1LoadBalancerIngressBuilder(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 (V1LoadBalancerIngress item : items) {V1LoadBalancerIngressBuilder builder = new V1LoadBalancerIngressBuilder(item);_visitables.get("ingress").add(builder);this.ingress.add(builder);} return (A)this;
  }
  public A removeFromIngress(io.kubernetes.client.openapi.models.V1LoadBalancerIngress... items) {
    for (V1LoadBalancerIngress item : items) {V1LoadBalancerIngressBuilder builder = new V1LoadBalancerIngressBuilder(item);_visitables.get("ingress").remove(builder);if (this.ingress != null) {this.ingress.remove(builder);}} return (A)this;
  }
  public A removeAllFromIngress(Collection items) {
    for (V1LoadBalancerIngress item : items) {V1LoadBalancerIngressBuilder builder = new V1LoadBalancerIngressBuilder(item);_visitables.get("ingress").remove(builder);if (this.ingress != null) {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()) {
      V1LoadBalancerIngressBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildIngress instead.
   * @return The buildable object.
   */
  @Deprecated
  public List getIngress() {
    return ingress != null ? build(ingress) : null;
  }
  public List buildIngress() {
    return ingress != null ? build(ingress) : null;
  }
  public V1LoadBalancerIngress buildIngress(Integer index) {
    return this.ingress.get(index).build();
  }
  public V1LoadBalancerIngress buildFirstIngress() {
    return this.ingress.get(0).build();
  }
  public V1LoadBalancerIngress buildLastIngress() {
    return this.ingress.get(ingress.size() - 1).build();
  }
  public V1LoadBalancerIngress buildMatchingIngress(Predicate predicate) {
    for (V1LoadBalancerIngressBuilder item: ingress) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public Boolean hasMatchingIngress(Predicate predicate) {
    for (V1LoadBalancerIngressBuilder item: ingress) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withIngress(List ingress) {
    if (this.ingress != null) { _visitables.get("ingress").removeAll(this.ingress);}
    if (ingress != null) {this.ingress = new ArrayList(); for (V1LoadBalancerIngress item : ingress){this.addToIngress(item);}} else { this.ingress = null;} return (A) this;
  }
  public A withIngress(io.kubernetes.client.openapi.models.V1LoadBalancerIngress... ingress) {
    if (this.ingress != null) {this.ingress.clear();}
    if (ingress != null) {for (V1LoadBalancerIngress item :ingress){ this.addToIngress(item);}} return (A) this;
  }
  public Boolean hasIngress() {
    return ingress != null && !ingress.isEmpty();
  }
  public V1LoadBalancerStatusFluent.IngressNested addNewIngress() {
    return new V1LoadBalancerStatusFluentImpl.IngressNestedImpl();
  }
  public V1LoadBalancerStatusFluent.IngressNested addNewIngressLike(V1LoadBalancerIngress item) {
    return new V1LoadBalancerStatusFluentImpl.IngressNestedImpl(-1, item);
  }
  public V1LoadBalancerStatusFluent.IngressNested setNewIngressLike(Integer index,V1LoadBalancerIngress item) {
    return new V1LoadBalancerStatusFluentImpl.IngressNestedImpl(index, item);
  }
  public V1LoadBalancerStatusFluent.IngressNested editIngress(Integer index) {
    if (ingress.size() <= index) throw new RuntimeException("Can't edit ingress. Index exceeds size.");
    return setNewIngressLike(index, buildIngress(index));
  }
  public V1LoadBalancerStatusFluent.IngressNested editFirstIngress() {
    if (ingress.size() == 0) throw new RuntimeException("Can't edit first ingress. The list is empty.");
    return setNewIngressLike(0, buildIngress(0));
  }
  public V1LoadBalancerStatusFluent.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 V1LoadBalancerStatusFluent.IngressNested editMatchingIngress(Predicate predicate) {
    int index = -1;
    for (int i=0;i extends V1LoadBalancerIngressFluentImpl> implements V1LoadBalancerStatusFluent.IngressNested,Nested{
    IngressNestedImpl(Integer index,V1LoadBalancerIngress item) {
      this.index = index;
      this.builder = new V1LoadBalancerIngressBuilder(this, item);
    }
    IngressNestedImpl() {
      this.index = -1;
      this.builder = new V1LoadBalancerIngressBuilder(this);
    }
    V1LoadBalancerIngressBuilder builder;
    Integer index;
    public N and() {
      return (N) V1LoadBalancerStatusFluentImpl.this.setToIngress(index,builder.build());
    }
    public N endIngress() {
      return and();
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy