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

io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationStatusFluentImpl 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 PriorityLevelConfigurationStatusFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationStatusFluent {

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

    public PriorityLevelConfigurationStatusFluentImpl() {
    }

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

    public A addToConditions(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationCondition item) {
        if (this.conditions == null) {this.conditions = new java.util.ArrayList();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder(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.PriorityLevelConfigurationCondition item) {
        if (this.conditions == null) {this.conditions = new java.util.ArrayList();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder(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.PriorityLevelConfigurationCondition... items) {
        if (this.conditions == null) {this.conditions = new java.util.ArrayList();}
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationCondition item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder(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.PriorityLevelConfigurationCondition item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
    }

    public A removeFromConditions(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationCondition... items) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationCondition item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder(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.PriorityLevelConfigurationCondition item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder(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.PriorityLevelConfigurationConditionBuilder 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.PriorityLevelConfigurationCondition buildCondition(int index) {
        return this.conditions.get(index).build();
    }

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

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

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationCondition buildMatchingCondition(java.util.function.Predicate predicate) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder 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.PriorityLevelConfigurationConditionBuilder 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.PriorityLevelConfigurationCondition item : conditions){this.addToConditions(item);}} else { this.conditions = null;} return (A) this;
    }

    public A withConditions(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationCondition... conditions) {
        if (this.conditions != null) {this.conditions.clear();}
        if (conditions != null) {for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationCondition 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 PriorityLevelConfigurationCondition(lastTransitionTime, message, reason, status, type));
    }

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

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationStatusFluent.ConditionsNested addNewConditionLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationCondition item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationStatusFluentImpl.ConditionsNestedImpl(-1, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationStatusFluent.ConditionsNested setNewConditionLike(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationCondition item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationStatusFluentImpl.ConditionsNestedImpl(index, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationStatusFluent.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.PriorityLevelConfigurationStatusFluent.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.PriorityLevelConfigurationStatusFluent.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.PriorityLevelConfigurationStatusFluent.ConditionsNested editMatchingCondition(java.util.function.Predicate predicate) {
        int index = -1;
        for (int i=0;i extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationStatusFluent.ConditionsNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationConditionBuilder builder;
        private final int index;

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

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

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

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


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy