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

io.alauda.kubernetes.api.model.LoadBalancerStatusFluentImpl Maven / Gradle / Ivy

There is a newer version: 0.2.12
Show newest version
package io.alauda.kubernetes.api.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.alauda.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import javax.validation.Valid;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;

public class LoadBalancerStatusFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements LoadBalancerStatusFluent{

    private List ingress =  new ArrayList();

    public LoadBalancerStatusFluentImpl(){
    }
    public LoadBalancerStatusFluentImpl(LoadBalancerStatus instance){
            this.withIngress(instance.getIngress()); 
    }

    public A addToIngress(int index,LoadBalancerIngress item){
            LoadBalancerIngressBuilder builder = new LoadBalancerIngressBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.ingress.add(index >= 0 ? index : ingress.size(), builder); return (A)this;
    }

    public A setToIngress(int index,LoadBalancerIngress item){
            LoadBalancerIngressBuilder builder = new LoadBalancerIngressBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= ingress.size()) { ingress.add(builder); } else { ingress.set(index, builder);}
             return (A)this;
    }

    public A addToIngress(LoadBalancerIngress... items){
            for (LoadBalancerIngress item : items) {LoadBalancerIngressBuilder builder = new LoadBalancerIngressBuilder(item);_visitables.add(builder);this.ingress.add(builder);} return (A)this;
    }

    public A addAllToIngress(Collection items){
            for (LoadBalancerIngress item : items) {LoadBalancerIngressBuilder builder = new LoadBalancerIngressBuilder(item);_visitables.add(builder);this.ingress.add(builder);} return (A)this;
    }

    public A removeFromIngress(LoadBalancerIngress... items){
            for (LoadBalancerIngress item : items) {LoadBalancerIngressBuilder builder = new LoadBalancerIngressBuilder(item);_visitables.remove(builder);this.ingress.remove(builder);} return (A)this;
    }

    public A removeAllFromIngress(Collection items){
            for (LoadBalancerIngress item : items) {LoadBalancerIngressBuilder builder = new LoadBalancerIngressBuilder(item);_visitables.remove(builder);this.ingress.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildIngress instead.
 */
@Deprecated public List getIngress(){
            return build(ingress);
    }

    public List buildIngress(){
            return build(ingress);
    }

    public LoadBalancerIngress buildIngress(int index){
            return this.ingress.get(index).build();
    }

    public LoadBalancerIngress buildFirstIngress(){
            return this.ingress.get(0).build();
    }

    public LoadBalancerIngress buildLastIngress(){
            return this.ingress.get(ingress.size() - 1).build();
    }

    public LoadBalancerIngress buildMatchingIngress(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (LoadBalancerIngressBuilder item: ingress) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withIngress(List ingress){
            _visitables.removeAll(this.ingress);
            this.ingress.clear();
            if (ingress != null) {for (LoadBalancerIngress item : ingress){this.addToIngress(item);}} return (A) this;
    }

    public A withIngress(LoadBalancerIngress... ingress){
            this.ingress.clear(); if (ingress != null) {for (LoadBalancerIngress item :ingress){ this.addToIngress(item);}} return (A) this;
    }

    public Boolean hasIngress(){
            return ingress!= null && !ingress.isEmpty();
    }

    public LoadBalancerStatusFluent.IngressNested addNewIngress(){
            return new IngressNestedImpl();
    }

    public LoadBalancerStatusFluent.IngressNested addNewIngressLike(LoadBalancerIngress item){
            return new IngressNestedImpl(-1, item);
    }

    public LoadBalancerStatusFluent.IngressNested setNewIngressLike(int index,LoadBalancerIngress item){
            return new IngressNestedImpl(index, item);
    }

    public LoadBalancerStatusFluent.IngressNested editIngress(int index){
            if (ingress.size() <= index) throw new RuntimeException("Can't edit ingress. Index exceeds size.");
            return setNewIngressLike(index, buildIngress(index));
    }

    public LoadBalancerStatusFluent.IngressNested editFirstIngress(){
            if (ingress.size() == 0) throw new RuntimeException("Can't edit first ingress. The list is empty.");
            return setNewIngressLike(0, buildIngress(0));
    }

    public LoadBalancerStatusFluent.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 LoadBalancerStatusFluent.IngressNested editMatchingIngress(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends LoadBalancerIngressFluentImpl> implements LoadBalancerStatusFluent.IngressNested,io.alauda.kubernetes.api.builder.Nested{

            private final LoadBalancerIngressBuilder builder;
        private final int index;
    
            IngressNestedImpl(int index,LoadBalancerIngress item){
                    this.index = index;
                    this.builder = new LoadBalancerIngressBuilder(this, item);
            }
            IngressNestedImpl(){
                    this.index = -1;
                    this.builder = new LoadBalancerIngressBuilder(this);
            }
    
    public N and(){
            return (N) LoadBalancerStatusFluentImpl.this.setToIngress(index, builder.build());
    }
    public N endIngress(){
            return and();
    }

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy