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

io.fabric8.kubernetes.api.model.extensions.IngressLoadBalancerStatusFluent Maven / Gradle / Ivy

There is a newer version: 6.13.4
Show newest version
package io.fabric8.kubernetes.api.model.extensions;

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

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class IngressLoadBalancerStatusFluent> extends BaseFluent{
  public IngressLoadBalancerStatusFluent() {
  }
  
  public IngressLoadBalancerStatusFluent(IngressLoadBalancerStatus instance) {
    this.copyInstance(instance);
  }
  private ArrayList ingress = new ArrayList();
  private Map additionalProperties;
  
  protected void copyInstance(IngressLoadBalancerStatus instance) {
    instance = (instance != null ? instance : new IngressLoadBalancerStatus());
    if (instance != null) {
          this.withIngress(instance.getIngress());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  
  public A addToIngress(int index,IngressLoadBalancerIngress item) {
    if (this.ingress == null) {this.ingress = new ArrayList();}
    IngressLoadBalancerIngressBuilder builder = new IngressLoadBalancerIngressBuilder(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,IngressLoadBalancerIngress item) {
    if (this.ingress == null) {this.ingress = new ArrayList();}
    IngressLoadBalancerIngressBuilder builder = new IngressLoadBalancerIngressBuilder(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.fabric8.kubernetes.api.model.extensions.IngressLoadBalancerIngress... items) {
    if (this.ingress == null) {this.ingress = new ArrayList();}
    for (IngressLoadBalancerIngress item : items) {IngressLoadBalancerIngressBuilder builder = new IngressLoadBalancerIngressBuilder(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 (IngressLoadBalancerIngress item : items) {IngressLoadBalancerIngressBuilder builder = new IngressLoadBalancerIngressBuilder(item);_visitables.get("ingress").add(builder);this.ingress.add(builder);} return (A)this;
  }
  
  public A removeFromIngress(io.fabric8.kubernetes.api.model.extensions.IngressLoadBalancerIngress... items) {
    if (this.ingress == null) return (A)this;
    for (IngressLoadBalancerIngress item : items) {IngressLoadBalancerIngressBuilder builder = new IngressLoadBalancerIngressBuilder(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 (IngressLoadBalancerIngress item : items) {IngressLoadBalancerIngressBuilder builder = new IngressLoadBalancerIngressBuilder(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()) {
      IngressLoadBalancerIngressBuilder 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 IngressLoadBalancerIngress buildIngress(int index) {
    return this.ingress.get(index).build();
  }
  
  public IngressLoadBalancerIngress buildFirstIngress() {
    return this.ingress.get(0).build();
  }
  
  public IngressLoadBalancerIngress buildLastIngress() {
    return this.ingress.get(ingress.size() - 1).build();
  }
  
  public IngressLoadBalancerIngress buildMatchingIngress(Predicate predicate) {
      for (IngressLoadBalancerIngressBuilder item : ingress) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingIngress(Predicate predicate) {
      for (IngressLoadBalancerIngressBuilder 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 (IngressLoadBalancerIngress item : ingress) {
          this.addToIngress(item);
        }
    } else {
      this.ingress = null;
    }
    return (A) this;
  }
  
  public A withIngress(io.fabric8.kubernetes.api.model.extensions.IngressLoadBalancerIngress... ingress) {
    if (this.ingress != null) {
        this.ingress.clear();
        _visitables.remove("ingress");
    }
    if (ingress != null) {
      for (IngressLoadBalancerIngress 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(IngressLoadBalancerIngress item) {
    return new IngressNested(-1, item);
  }
  
  public IngressNested setNewIngressLike(int index,IngressLoadBalancerIngress 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 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;
    IngressLoadBalancerStatusFluent that = (IngressLoadBalancerStatusFluent) o;
    if (!java.util.Objects.equals(ingress, that.ingress)) return false;
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(ingress,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (ingress != null && !ingress.isEmpty()) { sb.append("ingress:"); sb.append(ingress + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class IngressNested extends IngressLoadBalancerIngressFluent> implements Nested{
    IngressNested(int index,IngressLoadBalancerIngress item) {
      this.index = index;
      this.builder = new IngressLoadBalancerIngressBuilder(this, item);
    }
    IngressLoadBalancerIngressBuilder builder;
    int index;
    
    public N and() {
      return (N) IngressLoadBalancerStatusFluent.this.setToIngress(index,builder.build());
    }
    
    public N endIngress() {
      return and();
    }
    
  
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy