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

io.kubernetes.client.models.V1PodDNSConfigFluentImpl Maven / Gradle / Ivy

package io.kubernetes.client.models;

import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.kubernetes.client.fluent.Predicate;
import java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;

public class V1PodDNSConfigFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1PodDNSConfigFluent{

    private List nameservers;
    private List options;
    private List searches;

    public V1PodDNSConfigFluentImpl(){
    }
    public V1PodDNSConfigFluentImpl(V1PodDNSConfig instance){
            this.withNameservers(instance.getNameservers());

            this.withOptions(instance.getOptions());

            this.withSearches(instance.getSearches());

    }

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

    public A setToNameservers(int index,String item){
            this.nameservers.set(index, item); return (A)this;
    }

    public A addToNameservers(String... items){
            for (String item : items) {this.nameservers.add(item);} return (A)this;
    }

    public A addAllToNameservers(Collection items){
            for (String item : items) {this.nameservers.add(item);} return (A)this;
    }

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

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

    public List getNameservers(){
            return this.nameservers;
    }

    public String getNameserver(int index){
            return this.nameservers.get(index);
    }

    public String getFirstNameserver(){
            return this.nameservers.get(0);
    }

    public String getLastNameserver(){
            return this.nameservers.get(nameservers.size() - 1);
    }

    public String getMatchingNameserver(io.kubernetes.client.fluent.Predicate predicate){
            for (String item: nameservers) { if(predicate.apply(item)){return item;} } return null;
    }

    public A withNameservers(List nameservers){
            if (this.nameservers != null) { _visitables.removeAll(this.nameservers);}
            if (nameservers != null) {this.nameservers = new ArrayList(); for (String item : nameservers){this.addToNameservers(item);}} else { this.nameservers = null;} return (A) this;
    }

    public A withNameservers(String... nameservers){
            this.nameservers.clear(); if (nameservers != null) {for (String item :nameservers){ this.addToNameservers(item);}} return (A) this;
    }

    public Boolean hasNameservers(){
            return nameservers != null && !nameservers.isEmpty();
    }

    public A addToOptions(int index,V1PodDNSConfigOption item){
            if (this.options == null) {this.options = new ArrayList();}
            V1PodDNSConfigOptionBuilder builder = new V1PodDNSConfigOptionBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.options.add(index >= 0 ? index : options.size(), builder); return (A)this;
    }

    public A setToOptions(int index,V1PodDNSConfigOption item){
            if (this.options == null) {this.options = new ArrayList();}
            V1PodDNSConfigOptionBuilder builder = new V1PodDNSConfigOptionBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= options.size()) { options.add(builder); } else { options.set(index, builder);}
             return (A)this;
    }

    public A addToOptions(V1PodDNSConfigOption... items){
            if (this.options == null) {this.options = new ArrayList();}
            for (V1PodDNSConfigOption item : items) {V1PodDNSConfigOptionBuilder builder = new V1PodDNSConfigOptionBuilder(item);_visitables.add(builder);this.options.add(builder);} return (A)this;
    }

    public A addAllToOptions(Collection items){
            if (this.options == null) {this.options = new ArrayList();}
            for (V1PodDNSConfigOption item : items) {V1PodDNSConfigOptionBuilder builder = new V1PodDNSConfigOptionBuilder(item);_visitables.add(builder);this.options.add(builder);} return (A)this;
    }

    public A removeFromOptions(V1PodDNSConfigOption... items){
            for (V1PodDNSConfigOption item : items) {V1PodDNSConfigOptionBuilder builder = new V1PodDNSConfigOptionBuilder(item);_visitables.remove(builder);if (this.options != null) {this.options.remove(builder);}} return (A)this;
    }

    public A removeAllFromOptions(Collection items){
            for (V1PodDNSConfigOption item : items) {V1PodDNSConfigOptionBuilder builder = new V1PodDNSConfigOptionBuilder(item);_visitables.remove(builder);if (this.options != null) {this.options.remove(builder);}} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildOptions instead.
 */
@Deprecated public List getOptions(){
            return build(options);
    }

    public List buildOptions(){
            return build(options);
    }

    public V1PodDNSConfigOption buildOption(int index){
            return this.options.get(index).build();
    }

    public V1PodDNSConfigOption buildFirstOption(){
            return this.options.get(0).build();
    }

    public V1PodDNSConfigOption buildLastOption(){
            return this.options.get(options.size() - 1).build();
    }

    public V1PodDNSConfigOption buildMatchingOption(io.kubernetes.client.fluent.Predicate predicate){
            for (V1PodDNSConfigOptionBuilder item: options) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withOptions(List options){
            if (this.options != null) { _visitables.removeAll(this.options);}
            if (options != null) {this.options = new ArrayList(); for (V1PodDNSConfigOption item : options){this.addToOptions(item);}} else { this.options = null;} return (A) this;
    }

    public A withOptions(V1PodDNSConfigOption... options){
            this.options.clear(); if (options != null) {for (V1PodDNSConfigOption item :options){ this.addToOptions(item);}} return (A) this;
    }

    public Boolean hasOptions(){
            return options != null && !options.isEmpty();
    }

    public V1PodDNSConfigFluent.OptionsNested addNewOption(){
            return new OptionsNestedImpl();
    }

    public V1PodDNSConfigFluent.OptionsNested addNewOptionLike(V1PodDNSConfigOption item){
            return new OptionsNestedImpl(-1, item);
    }

    public V1PodDNSConfigFluent.OptionsNested setNewOptionLike(int index,V1PodDNSConfigOption item){
            return new OptionsNestedImpl(index, item);
    }

    public V1PodDNSConfigFluent.OptionsNested editOption(int index){
            if (options.size() <= index) throw new RuntimeException("Can't edit options. Index exceeds size.");
            return setNewOptionLike(index, buildOption(index));
    }

    public V1PodDNSConfigFluent.OptionsNested editFirstOption(){
            if (options.size() == 0) throw new RuntimeException("Can't edit first options. The list is empty.");
            return setNewOptionLike(0, buildOption(0));
    }

    public V1PodDNSConfigFluent.OptionsNested editLastOption(){
            int index = options.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last options. The list is empty.");
            return setNewOptionLike(index, buildOption(index));
    }

    public V1PodDNSConfigFluent.OptionsNested editMatchingOption(io.kubernetes.client.fluent.Predicate predicate){
            int index = -1;
            for (int i=0;i();}
            this.searches.add(index, item);
            return (A)this;
    }

    public A setToSearches(int index,String item){
            this.searches.set(index, item); return (A)this;
    }

    public A addToSearches(String... items){
            for (String item : items) {this.searches.add(item);} return (A)this;
    }

    public A addAllToSearches(Collection items){
            for (String item : items) {this.searches.add(item);} return (A)this;
    }

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

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

    public List getSearches(){
            return this.searches;
    }

    public String getSearch(int index){
            return this.searches.get(index);
    }

    public String getFirstSearch(){
            return this.searches.get(0);
    }

    public String getLastSearch(){
            return this.searches.get(searches.size() - 1);
    }

    public String getMatchingSearch(io.kubernetes.client.fluent.Predicate predicate){
            for (String item: searches) { if(predicate.apply(item)){return item;} } return null;
    }

    public A withSearches(List searches){
            if (this.searches != null) { _visitables.removeAll(this.searches);}
            if (searches != null) {this.searches = new ArrayList(); for (String item : searches){this.addToSearches(item);}} else { this.searches = null;} return (A) this;
    }

    public A withSearches(String... searches){
            this.searches.clear(); if (searches != null) {for (String item :searches){ this.addToSearches(item);}} return (A) this;
    }

    public Boolean hasSearches(){
            return searches != null && !searches.isEmpty();
    }

    public boolean equals(Object o){
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            if (!super.equals(o)) return false;
            V1PodDNSConfigFluentImpl that = (V1PodDNSConfigFluentImpl) o;
            if (nameservers != null ? !nameservers.equals(that.nameservers) :that.nameservers != null) return false;
            if (options != null ? !options.equals(that.options) :that.options != null) return false;
            if (searches != null ? !searches.equals(that.searches) :that.searches != null) return false;
            return true;
    }


    public class OptionsNestedImpl extends V1PodDNSConfigOptionFluentImpl> implements V1PodDNSConfigFluent.OptionsNested,io.kubernetes.client.fluent.Nested{

            private final V1PodDNSConfigOptionBuilder builder;
        private final int index;
    
            OptionsNestedImpl(int index,V1PodDNSConfigOption item){
                    this.index = index;
                    this.builder = new V1PodDNSConfigOptionBuilder(this, item);
            }
            OptionsNestedImpl(){
                    this.index = -1;
                    this.builder = new V1PodDNSConfigOptionBuilder(this);
            }
    
    public N and(){
            return (N) V1PodDNSConfigFluentImpl.this.setToOptions(index, builder.build());
    }
    public N endOption(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy