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

io.fabric8.kubernetes.api.model.PersistentVolumeClaimStatusFluentImpl Maven / Gradle / Ivy

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

import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.lang.StringBuilder;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.fabric8.kubernetes.api.builder.Predicate;
import java.util.LinkedHashMap;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import java.lang.StringBuffer;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;

public class PersistentVolumeClaimStatusFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements PersistentVolumeClaimStatusFluent{

    private List accessModes = new ArrayList();
    private Map capacity;
    private List conditions =  new ArrayList();
    private String phase;

    public PersistentVolumeClaimStatusFluentImpl(){
    }
    public PersistentVolumeClaimStatusFluentImpl(PersistentVolumeClaimStatus instance){
            this.withAccessModes(instance.getAccessModes()); 
            this.withCapacity(instance.getCapacity()); 
            this.withConditions(instance.getConditions()); 
            this.withPhase(instance.getPhase()); 
    }

    public A addToAccessModes(int index,String item){
            if (this.accessModes == null) {this.accessModes = new ArrayList();}
            this.accessModes.add(index, item);
            return (A)this;
    }

    public A setToAccessModes(int index,String item){
            if (this.accessModes == null) {this.accessModes = new ArrayList();}
            this.accessModes.set(index, item); return (A)this;
    }

    public A addToAccessModes(String... items){
            if (this.accessModes == null) {this.accessModes = new ArrayList();}
            for (String item : items) {this.accessModes.add(item);} return (A)this;
    }

    public A addAllToAccessModes(Collection items){
            if (this.accessModes == null) {this.accessModes = new ArrayList();}
            for (String item : items) {this.accessModes.add(item);} return (A)this;
    }

    public A removeFromAccessModes(String... items){
            for (String item : items) {if (this.accessModes!= null){ this.accessModes.remove(item);}} return (A)this;
    }

    public A removeAllFromAccessModes(Collection items){
            for (String item : items) {if (this.accessModes!= null){ this.accessModes.remove(item);}} return (A)this;
    }

    public List getAccessModes(){
            return this.accessModes;
    }

    public String getAccessMode(int index){
            return this.accessModes.get(index);
    }

    public String getFirstAccessMode(){
            return this.accessModes.get(0);
    }

    public String getLastAccessMode(){
            return this.accessModes.get(accessModes.size() - 1);
    }

    public String getMatchingAccessMode(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (String item: accessModes) { if(predicate.apply(item)){ return item;} } return null;
    }

    public Boolean hasMatchingAccessMode(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (String item: accessModes) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withAccessModes(List accessModes){
            if (this.accessModes != null) { _visitables.get("accessModes").removeAll(this.accessModes);}
            if (accessModes != null) {this.accessModes = new ArrayList(); for (String item : accessModes){this.addToAccessModes(item);}} else { this.accessModes = null;} return (A) this;
    }

    public A withAccessModes(String... accessModes){
            if (this.accessModes != null) {this.accessModes.clear();}
            if (accessModes != null) {for (String item :accessModes){ this.addToAccessModes(item);}} return (A) this;
    }

    public Boolean hasAccessModes(){
            return accessModes != null && !accessModes.isEmpty();
    }

    public A addNewAccessMode(String arg1){
            return (A)addToAccessModes(new String(arg1));
    }

    public A addNewAccessMode(StringBuilder arg1){
            return (A)addToAccessModes(new String(arg1));
    }

    public A addNewAccessMode(StringBuffer arg1){
            return (A)addToAccessModes(new String(arg1));
    }

    public A addToCapacity(String key,Quantity value){
            if(this.capacity == null && key != null && value != null) { this.capacity = new LinkedHashMap(); }
            if(key != null && value != null) {this.capacity.put(key, value);} return (A)this;
    }

    public A addToCapacity(Map map){
            if(this.capacity == null && map != null) { this.capacity = new LinkedHashMap(); }
            if(map != null) { this.capacity.putAll(map);} return (A)this;
    }

    public A removeFromCapacity(String key){
            if(this.capacity == null) { return (A) this; }
            if(key != null && this.capacity != null) {this.capacity.remove(key);} return (A)this;
    }

    public A removeFromCapacity(Map map){
            if(this.capacity == null) { return (A) this; }
            if(map != null) { for(Object key : map.keySet()) {if (this.capacity != null){this.capacity.remove(key);}}} return (A)this;
    }

    public Map getCapacity(){
            return this.capacity;
    }

    public A withCapacity(Map capacity){
            if (capacity == null) { this.capacity =  null;} else {this.capacity = new LinkedHashMap(capacity);} return (A) this;
    }

    public Boolean hasCapacity(){
            return this.capacity != null;
    }

    public A addToConditions(int index,PersistentVolumeClaimCondition item){
            if (this.conditions == null) {this.conditions = new ArrayList();}
            PersistentVolumeClaimConditionBuilder builder = new PersistentVolumeClaimConditionBuilder(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,PersistentVolumeClaimCondition item){
            if (this.conditions == null) {this.conditions = new ArrayList();}
            PersistentVolumeClaimConditionBuilder builder = new PersistentVolumeClaimConditionBuilder(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(PersistentVolumeClaimCondition... items){
            if (this.conditions == null) {this.conditions = new ArrayList();}
            for (PersistentVolumeClaimCondition item : items) {PersistentVolumeClaimConditionBuilder builder = new PersistentVolumeClaimConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
    }

    public A addAllToConditions(Collection items){
            if (this.conditions == null) {this.conditions = new ArrayList();}
            for (PersistentVolumeClaimCondition item : items) {PersistentVolumeClaimConditionBuilder builder = new PersistentVolumeClaimConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
    }

    public A removeFromConditions(PersistentVolumeClaimCondition... items){
            for (PersistentVolumeClaimCondition item : items) {PersistentVolumeClaimConditionBuilder builder = new PersistentVolumeClaimConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
    }

    public A removeAllFromConditions(Collection items){
            for (PersistentVolumeClaimCondition item : items) {PersistentVolumeClaimConditionBuilder builder = new PersistentVolumeClaimConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromConditions(io.fabric8.kubernetes.api.builder.Predicate predicate){
            if (conditions == null) return (A) this;
            final Iterator each = conditions.iterator();
            final List visitables = _visitables.get("conditions");
            while (each.hasNext()) {
              PersistentVolumeClaimConditionBuilder builder = each.next();
              if (predicate.apply(builder)) {
                visitables.remove(builder);
                each.remove();
              }
            }
            return (A)this;
    }

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

    public List buildConditions(){
            return build(conditions);
    }

    public PersistentVolumeClaimCondition buildCondition(int index){
            return this.conditions.get(index).build();
    }

    public PersistentVolumeClaimCondition buildFirstCondition(){
            return this.conditions.get(0).build();
    }

    public PersistentVolumeClaimCondition buildLastCondition(){
            return this.conditions.get(conditions.size() - 1).build();
    }

    public PersistentVolumeClaimCondition buildMatchingCondition(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (PersistentVolumeClaimConditionBuilder item: conditions) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingCondition(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (PersistentVolumeClaimConditionBuilder item: conditions) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withConditions(List conditions){
            if (this.conditions != null) { _visitables.get("conditions").removeAll(this.conditions);}
            if (conditions != null) {this.conditions = new ArrayList(); for (PersistentVolumeClaimCondition item : conditions){this.addToConditions(item);}} else { this.conditions = null;} return (A) this;
    }

    public A withConditions(PersistentVolumeClaimCondition... conditions){
            if (this.conditions != null) {this.conditions.clear();}
            if (conditions != null) {for (PersistentVolumeClaimCondition item :conditions){ this.addToConditions(item);}} return (A) this;
    }

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

    public PersistentVolumeClaimStatusFluent.ConditionsNested addNewCondition(){
            return new ConditionsNestedImpl();
    }

    public PersistentVolumeClaimStatusFluent.ConditionsNested addNewConditionLike(PersistentVolumeClaimCondition item){
            return new ConditionsNestedImpl(-1, item);
    }

    public PersistentVolumeClaimStatusFluent.ConditionsNested setNewConditionLike(int index,PersistentVolumeClaimCondition item){
            return new ConditionsNestedImpl(index, item);
    }

    public PersistentVolumeClaimStatusFluent.ConditionsNested editCondition(int index){
            if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
            return setNewConditionLike(index, buildCondition(index));
    }

    public PersistentVolumeClaimStatusFluent.ConditionsNested editFirstCondition(){
            if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
            return setNewConditionLike(0, buildCondition(0));
    }

    public PersistentVolumeClaimStatusFluent.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 PersistentVolumeClaimStatusFluent.ConditionsNested editMatchingCondition(io.fabric8.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends PersistentVolumeClaimConditionFluentImpl> implements PersistentVolumeClaimStatusFluent.ConditionsNested,io.fabric8.kubernetes.api.builder.Nested{

            private final PersistentVolumeClaimConditionBuilder builder;
        private final int index;
    
            ConditionsNestedImpl(int index,PersistentVolumeClaimCondition item){
                    this.index = index;
                    this.builder = new PersistentVolumeClaimConditionBuilder(this, item);
            }
            ConditionsNestedImpl(){
                    this.index = -1;
                    this.builder = new PersistentVolumeClaimConditionBuilder(this);
            }
    
    public N and(){
            return (N) PersistentVolumeClaimStatusFluentImpl.this.setToConditions(index,builder.build());
    }
    public N endCondition(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy