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

io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluentImpl Maven / Gradle / Ivy

There is a newer version: 7.0.1
Show newest version
package io.fabric8.kubernetes.api.model.flowcontrol.v1beta1;

import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.function.Predicate;
import java.lang.Deprecated;
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.lang.Boolean;

public class FlowSchemaStatusFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluent {

    private java.util.List conditions =  new java.util.ArrayList();

    public FlowSchemaStatusFluentImpl() {
    }

    public FlowSchemaStatusFluentImpl(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatus instance) {
        this.withConditions(instance.getConditions()); 
    }

    public A addToConditions(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item) {
        if (this.conditions == null) {this.conditions = new java.util.ArrayList();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder(item);_visitables.get("conditions").add(index >= 0 ? index : _visitables.get("conditions").size(), builder);this.conditions.add(index >= 0 ? index : conditions.size(), builder); return (A)this;
    }

    public A setToConditions(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item) {
        if (this.conditions == null) {this.conditions = new java.util.ArrayList();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder(item);
        if (index < 0 || index >= _visitables.get("conditions").size()) { _visitables.get("conditions").add(builder); } else { _visitables.get("conditions").set(index, builder);}
        if (index < 0 || index >= conditions.size()) { conditions.add(builder); } else { conditions.set(index, builder);}
         return (A)this;
    }

    public A addToConditions(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition... items) {
        if (this.conditions == null) {this.conditions = new java.util.ArrayList();}
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
    }

    public A addAllToConditions(java.util.Collection items) {
        if (this.conditions == null) {this.conditions = new java.util.ArrayList();}
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
    }

    public A removeFromConditions(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition... items) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
    }

    public A removeAllFromConditions(java.util.Collection items) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromConditions(java.util.function.Predicate predicate) {
        if (conditions == null) return (A) this;
        final Iterator each = conditions.iterator();
        final List visitables = _visitables.get("conditions");
        while (each.hasNext()) {
          io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder builder = each.next();
          if (predicate.test(builder)) {
            visitables.remove(builder);
            each.remove();
          }
        }
        return (A)this;
    }

    
    @java.lang.Deprecated
        
    /**
     * This method has been deprecated, please use method buildConditions instead.
     * @return The buildable object.
     */
        public java.util.List getConditions() {
        return build(conditions);
    }

    public java.util.List buildConditions() {
        return build(conditions);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition buildCondition(int index) {
        return this.conditions.get(index).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition buildFirstCondition() {
        return this.conditions.get(0).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition buildLastCondition() {
        return this.conditions.get(conditions.size() - 1).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition buildMatchingCondition(java.util.function.Predicate predicate) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder item: conditions) { if(predicate.test(item)){ return item.build();} } return null;
    }

    public java.lang.Boolean hasMatchingCondition(java.util.function.Predicate predicate) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder item: conditions) { if(predicate.test(item)){ return true;} } return false;
    }

    public A withConditions(java.util.List conditions) {
        if (this.conditions != null) { _visitables.get("conditions").removeAll(this.conditions);}
        if (conditions != null) {this.conditions = new java.util.ArrayList(); for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item : conditions){this.addToConditions(item);}} else { this.conditions = null;} return (A) this;
    }

    public A withConditions(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition... conditions) {
        if (this.conditions != null) {this.conditions.clear();}
        if (conditions != null) {for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item :conditions){ this.addToConditions(item);}} return (A) this;
    }

    public java.lang.Boolean hasConditions() {
        return conditions != null && !conditions.isEmpty();
    }

    public A addNewCondition(java.lang.String lastTransitionTime,java.lang.String message,java.lang.String reason,java.lang.String status,java.lang.String type) {
        return (A)addToConditions(new FlowSchemaCondition(lastTransitionTime, message, reason, status, type));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluent.ConditionsNested addNewCondition() {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluentImpl.ConditionsNestedImpl();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluent.ConditionsNested addNewConditionLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluentImpl.ConditionsNestedImpl(-1, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluent.ConditionsNested setNewConditionLike(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluentImpl.ConditionsNestedImpl(index, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluent.ConditionsNested editCondition(int index) {
        if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
        return setNewConditionLike(index, buildCondition(index));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluent.ConditionsNested editFirstCondition() {
        if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
        return setNewConditionLike(0, buildCondition(0));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluent.ConditionsNested editLastCondition() {
        int index = conditions.size() - 1;
        if (index < 0) throw new RuntimeException("Can't edit last conditions. The list is empty.");
        return setNewConditionLike(index, buildCondition(index));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluent.ConditionsNested editMatchingCondition(java.util.function.Predicate predicate) {
        int index = -1;
        for (int i=0;i extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaStatusFluent.ConditionsNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder builder;
        private final int index;

            ConditionsNestedImpl(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaCondition item) {
                this.index = index;
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder(this, item);
                        
            }

            ConditionsNestedImpl() {
                this.index = -1;
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaConditionBuilder(this);
                        
            }

            public N and() {
                return (N) FlowSchemaStatusFluentImpl.this.setToConditions(index,builder.build());
            }

            public N endCondition() {
                return and();
            }
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy