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

io.kubernetes.client.openapi.models.V1beta1PolicyRuleFluentImpl Maven / Gradle / Ivy

There is a newer version: 22.0.0
Show newest version
package io.kubernetes.client.openapi.models;

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

public class V1beta1PolicyRuleFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1beta1PolicyRuleFluent {

    private List apiGroups;
    private List nonResourceURLs;
    private List resourceNames;
    private List resources;
    private List verbs;

    public V1beta1PolicyRuleFluentImpl() { 
    }


    public V1beta1PolicyRuleFluentImpl(V1beta1PolicyRule instance) { 
        this.withApiGroups(instance.getApiGroups());

        this.withNonResourceURLs(instance.getNonResourceURLs());

        this.withResourceNames(instance.getResourceNames());

        this.withResources(instance.getResources());

        this.withVerbs(instance.getVerbs());

    }


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

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

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

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

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

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

    public List getApiGroups() {
        return this.apiGroups;
    }

    public String getApiGroup(int index) {
        return this.apiGroups.get(index);
    }

    public String getFirstApiGroup() {
        return this.apiGroups.get(0);
    }

    public String getLastApiGroup() {
        return this.apiGroups.get(apiGroups.size() - 1);
    }

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

    public Boolean hasMatchingApiGroup(io.kubernetes.client.fluent.Predicate predicate) {
        for (String item: apiGroups) { if(predicate.apply(item)){ return true;} } return false;
    }

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

    public A withApiGroups(String... apiGroups) {
        if (this.apiGroups != null) {this.apiGroups.clear();}
        if (apiGroups != null) {for (String item :apiGroups){ this.addToApiGroups(item);}} return (A) this;
    }

    public Boolean hasApiGroups() {
        return apiGroups != null && !apiGroups.isEmpty();
    }

    public A addNewApiGroup(String arg1) {
        return (A)addToApiGroups(new String(arg1));
    }

    public A addNewApiGroup(StringBuilder arg1) {
        return (A)addToApiGroups(new String(arg1));
    }

    public A addNewApiGroup(StringBuffer arg1) {
        return (A)addToApiGroups(new String(arg1));
    }

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

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

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

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

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

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

    public List getNonResourceURLs() {
        return this.nonResourceURLs;
    }

    public String getNonResourceURL(int index) {
        return this.nonResourceURLs.get(index);
    }

    public String getFirstNonResourceURL() {
        return this.nonResourceURLs.get(0);
    }

    public String getLastNonResourceURL() {
        return this.nonResourceURLs.get(nonResourceURLs.size() - 1);
    }

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

    public Boolean hasMatchingNonResourceURL(io.kubernetes.client.fluent.Predicate predicate) {
        for (String item: nonResourceURLs) { if(predicate.apply(item)){ return true;} } return false;
    }

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

    public A withNonResourceURLs(String... nonResourceURLs) {
        if (this.nonResourceURLs != null) {this.nonResourceURLs.clear();}
        if (nonResourceURLs != null) {for (String item :nonResourceURLs){ this.addToNonResourceURLs(item);}} return (A) this;
    }

    public Boolean hasNonResourceURLs() {
        return nonResourceURLs != null && !nonResourceURLs.isEmpty();
    }

    public A addNewNonResourceURL(String arg1) {
        return (A)addToNonResourceURLs(new String(arg1));
    }

    public A addNewNonResourceURL(StringBuilder arg1) {
        return (A)addToNonResourceURLs(new String(arg1));
    }

    public A addNewNonResourceURL(StringBuffer arg1) {
        return (A)addToNonResourceURLs(new String(arg1));
    }

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

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

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

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

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

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

    public List getResourceNames() {
        return this.resourceNames;
    }

    public String getResourceName(int index) {
        return this.resourceNames.get(index);
    }

    public String getFirstResourceName() {
        return this.resourceNames.get(0);
    }

    public String getLastResourceName() {
        return this.resourceNames.get(resourceNames.size() - 1);
    }

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

    public Boolean hasMatchingResourceName(io.kubernetes.client.fluent.Predicate predicate) {
        for (String item: resourceNames) { if(predicate.apply(item)){ return true;} } return false;
    }

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

    public A withResourceNames(String... resourceNames) {
        if (this.resourceNames != null) {this.resourceNames.clear();}
        if (resourceNames != null) {for (String item :resourceNames){ this.addToResourceNames(item);}} return (A) this;
    }

    public Boolean hasResourceNames() {
        return resourceNames != null && !resourceNames.isEmpty();
    }

    public A addNewResourceName(String arg1) {
        return (A)addToResourceNames(new String(arg1));
    }

    public A addNewResourceName(StringBuilder arg1) {
        return (A)addToResourceNames(new String(arg1));
    }

    public A addNewResourceName(StringBuffer arg1) {
        return (A)addToResourceNames(new String(arg1));
    }

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

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

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

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

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

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

    public List getResources() {
        return this.resources;
    }

    public String getResource(int index) {
        return this.resources.get(index);
    }

    public String getFirstResource() {
        return this.resources.get(0);
    }

    public String getLastResource() {
        return this.resources.get(resources.size() - 1);
    }

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

    public Boolean hasMatchingResource(io.kubernetes.client.fluent.Predicate predicate) {
        for (String item: resources) { if(predicate.apply(item)){ return true;} } return false;
    }

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

    public A withResources(String... resources) {
        if (this.resources != null) {this.resources.clear();}
        if (resources != null) {for (String item :resources){ this.addToResources(item);}} return (A) this;
    }

    public Boolean hasResources() {
        return resources != null && !resources.isEmpty();
    }

    public A addNewResource(String arg1) {
        return (A)addToResources(new String(arg1));
    }

    public A addNewResource(StringBuilder arg1) {
        return (A)addToResources(new String(arg1));
    }

    public A addNewResource(StringBuffer arg1) {
        return (A)addToResources(new String(arg1));
    }

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

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

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

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

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

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

    public List getVerbs() {
        return this.verbs;
    }

    public String getVerb(int index) {
        return this.verbs.get(index);
    }

    public String getFirstVerb() {
        return this.verbs.get(0);
    }

    public String getLastVerb() {
        return this.verbs.get(verbs.size() - 1);
    }

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

    public Boolean hasMatchingVerb(io.kubernetes.client.fluent.Predicate predicate) {
        for (String item: verbs) { if(predicate.apply(item)){ return true;} } return false;
    }

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

    public A withVerbs(String... verbs) {
        if (this.verbs != null) {this.verbs.clear();}
        if (verbs != null) {for (String item :verbs){ this.addToVerbs(item);}} return (A) this;
    }

    public Boolean hasVerbs() {
        return verbs != null && !verbs.isEmpty();
    }

    public A addNewVerb(String arg1) {
        return (A)addToVerbs(new String(arg1));
    }

    public A addNewVerb(StringBuilder arg1) {
        return (A)addToVerbs(new String(arg1));
    }

    public A addNewVerb(StringBuffer arg1) {
        return (A)addToVerbs(new String(arg1));
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        V1beta1PolicyRuleFluentImpl that = (V1beta1PolicyRuleFluentImpl) o;
        if (apiGroups != null ? !apiGroups.equals(that.apiGroups) :that.apiGroups != null) return false;
        if (nonResourceURLs != null ? !nonResourceURLs.equals(that.nonResourceURLs) :that.nonResourceURLs != null) return false;
        if (resourceNames != null ? !resourceNames.equals(that.resourceNames) :that.resourceNames != null) return false;
        if (resources != null ? !resources.equals(that.resources) :that.resources != null) return false;
        if (verbs != null ? !verbs.equals(that.verbs) :that.verbs != null) return false;
        return true;
    }

    public int hashCode() {
        return java.util.Objects.hash(apiGroups,  nonResourceURLs,  resourceNames,  resources,  verbs,  super.hashCode());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy