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

io.kubernetes.client.models.V1alpha1ClusterRoleBindingFluentImpl 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.List;
import java.lang.Boolean;
import java.util.Collection;
import java.lang.Object;

public class V1alpha1ClusterRoleBindingFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1alpha1ClusterRoleBindingFluent{

    private String apiVersion;
    private String kind;
    private V1ObjectMetaBuilder metadata;
    private V1alpha1RoleRefBuilder roleRef;
    private List subjects;

    public V1alpha1ClusterRoleBindingFluentImpl(){
    }
    public V1alpha1ClusterRoleBindingFluentImpl(V1alpha1ClusterRoleBinding instance){
            this.withApiVersion(instance.getApiVersion());

            this.withKind(instance.getKind());

            this.withMetadata(instance.getMetadata());

            this.withRoleRef(instance.getRoleRef());

            this.withSubjects(instance.getSubjects());

    }

    public String getApiVersion(){
            return this.apiVersion;
    }

    public A withApiVersion(String apiVersion){
            this.apiVersion=apiVersion; return (A) this;
    }

    public Boolean hasApiVersion(){
            return this.apiVersion != null;
    }

    public String getKind(){
            return this.kind;
    }

    public A withKind(String kind){
            this.kind=kind; return (A) this;
    }

    public Boolean hasKind(){
            return this.kind != null;
    }

    
/**
 * This method has been deprecated, please use method buildMetadata instead.
 */
@Deprecated public V1ObjectMeta getMetadata(){
            return this.metadata!=null?this.metadata.build():null;
    }

    public V1ObjectMeta buildMetadata(){
            return this.metadata!=null?this.metadata.build():null;
    }

    public A withMetadata(V1ObjectMeta metadata){
            _visitables.remove(this.metadata);
            if (metadata!=null){ this.metadata= new V1ObjectMetaBuilder(metadata); _visitables.add(this.metadata);} return (A) this;
    }

    public Boolean hasMetadata(){
            return this.metadata != null;
    }

    public V1alpha1ClusterRoleBindingFluent.MetadataNested withNewMetadata(){
            return new MetadataNestedImpl();
    }

    public V1alpha1ClusterRoleBindingFluent.MetadataNested withNewMetadataLike(V1ObjectMeta item){
            return new MetadataNestedImpl(item);
    }

    public V1alpha1ClusterRoleBindingFluent.MetadataNested editMetadata(){
            return withNewMetadataLike(getMetadata());
    }

    public V1alpha1ClusterRoleBindingFluent.MetadataNested editOrNewMetadata(){
            return withNewMetadataLike(getMetadata() != null ? getMetadata(): new V1ObjectMetaBuilder().build());
    }

    public V1alpha1ClusterRoleBindingFluent.MetadataNested editOrNewMetadataLike(V1ObjectMeta item){
            return withNewMetadataLike(getMetadata() != null ? getMetadata(): item);
    }

    
/**
 * This method has been deprecated, please use method buildRoleRef instead.
 */
@Deprecated public V1alpha1RoleRef getRoleRef(){
            return this.roleRef!=null?this.roleRef.build():null;
    }

    public V1alpha1RoleRef buildRoleRef(){
            return this.roleRef!=null?this.roleRef.build():null;
    }

    public A withRoleRef(V1alpha1RoleRef roleRef){
            _visitables.remove(this.roleRef);
            if (roleRef!=null){ this.roleRef= new V1alpha1RoleRefBuilder(roleRef); _visitables.add(this.roleRef);} return (A) this;
    }

    public Boolean hasRoleRef(){
            return this.roleRef != null;
    }

    public V1alpha1ClusterRoleBindingFluent.RoleRefNested withNewRoleRef(){
            return new RoleRefNestedImpl();
    }

    public V1alpha1ClusterRoleBindingFluent.RoleRefNested withNewRoleRefLike(V1alpha1RoleRef item){
            return new RoleRefNestedImpl(item);
    }

    public V1alpha1ClusterRoleBindingFluent.RoleRefNested editRoleRef(){
            return withNewRoleRefLike(getRoleRef());
    }

    public V1alpha1ClusterRoleBindingFluent.RoleRefNested editOrNewRoleRef(){
            return withNewRoleRefLike(getRoleRef() != null ? getRoleRef(): new V1alpha1RoleRefBuilder().build());
    }

    public V1alpha1ClusterRoleBindingFluent.RoleRefNested editOrNewRoleRefLike(V1alpha1RoleRef item){
            return withNewRoleRefLike(getRoleRef() != null ? getRoleRef(): item);
    }

    public A addToSubjects(int index,V1alpha1Subject item){
            if (this.subjects == null) {this.subjects = new ArrayList();}
            V1alpha1SubjectBuilder builder = new V1alpha1SubjectBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.subjects.add(index >= 0 ? index : subjects.size(), builder); return (A)this;
    }

    public A setToSubjects(int index,V1alpha1Subject item){
            if (this.subjects == null) {this.subjects = new ArrayList();}
            V1alpha1SubjectBuilder builder = new V1alpha1SubjectBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= subjects.size()) { subjects.add(builder); } else { subjects.set(index, builder);}
             return (A)this;
    }

    public A addToSubjects(V1alpha1Subject... items){
            if (this.subjects == null) {this.subjects = new ArrayList();}
            for (V1alpha1Subject item : items) {V1alpha1SubjectBuilder builder = new V1alpha1SubjectBuilder(item);_visitables.add(builder);this.subjects.add(builder);} return (A)this;
    }

    public A addAllToSubjects(Collection items){
            if (this.subjects == null) {this.subjects = new ArrayList();}
            for (V1alpha1Subject item : items) {V1alpha1SubjectBuilder builder = new V1alpha1SubjectBuilder(item);_visitables.add(builder);this.subjects.add(builder);} return (A)this;
    }

    public A removeFromSubjects(V1alpha1Subject... items){
            for (V1alpha1Subject item : items) {V1alpha1SubjectBuilder builder = new V1alpha1SubjectBuilder(item);_visitables.remove(builder);if (this.subjects != null) {this.subjects.remove(builder);}} return (A)this;
    }

    public A removeAllFromSubjects(Collection items){
            for (V1alpha1Subject item : items) {V1alpha1SubjectBuilder builder = new V1alpha1SubjectBuilder(item);_visitables.remove(builder);if (this.subjects != null) {this.subjects.remove(builder);}} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildSubjects instead.
 */
@Deprecated public List getSubjects(){
            return build(subjects);
    }

    public List buildSubjects(){
            return build(subjects);
    }

    public V1alpha1Subject buildSubject(int index){
            return this.subjects.get(index).build();
    }

    public V1alpha1Subject buildFirstSubject(){
            return this.subjects.get(0).build();
    }

    public V1alpha1Subject buildLastSubject(){
            return this.subjects.get(subjects.size() - 1).build();
    }

    public V1alpha1Subject buildMatchingSubject(io.kubernetes.client.fluent.Predicate predicate){
            for (V1alpha1SubjectBuilder item: subjects) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withSubjects(List subjects){
            if (this.subjects != null) { _visitables.removeAll(this.subjects);}
            if (subjects != null) {this.subjects = new ArrayList(); for (V1alpha1Subject item : subjects){this.addToSubjects(item);}} else { this.subjects = null;} return (A) this;
    }

    public A withSubjects(V1alpha1Subject... subjects){
            this.subjects.clear(); if (subjects != null) {for (V1alpha1Subject item :subjects){ this.addToSubjects(item);}} return (A) this;
    }

    public Boolean hasSubjects(){
            return subjects != null && !subjects.isEmpty();
    }

    public V1alpha1ClusterRoleBindingFluent.SubjectsNested addNewSubject(){
            return new SubjectsNestedImpl();
    }

    public V1alpha1ClusterRoleBindingFluent.SubjectsNested addNewSubjectLike(V1alpha1Subject item){
            return new SubjectsNestedImpl(-1, item);
    }

    public V1alpha1ClusterRoleBindingFluent.SubjectsNested setNewSubjectLike(int index,V1alpha1Subject item){
            return new SubjectsNestedImpl(index, item);
    }

    public V1alpha1ClusterRoleBindingFluent.SubjectsNested editSubject(int index){
            if (subjects.size() <= index) throw new RuntimeException("Can't edit subjects. Index exceeds size.");
            return setNewSubjectLike(index, buildSubject(index));
    }

    public V1alpha1ClusterRoleBindingFluent.SubjectsNested editFirstSubject(){
            if (subjects.size() == 0) throw new RuntimeException("Can't edit first subjects. The list is empty.");
            return setNewSubjectLike(0, buildSubject(0));
    }

    public V1alpha1ClusterRoleBindingFluent.SubjectsNested editLastSubject(){
            int index = subjects.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last subjects. The list is empty.");
            return setNewSubjectLike(index, buildSubject(index));
    }

    public V1alpha1ClusterRoleBindingFluent.SubjectsNested editMatchingSubject(io.kubernetes.client.fluent.Predicate predicate){
            int index = -1;
            for (int i=0;i extends V1ObjectMetaFluentImpl> implements V1alpha1ClusterRoleBindingFluent.MetadataNested,io.kubernetes.client.fluent.Nested{

            private final V1ObjectMetaBuilder builder;
    
            MetadataNestedImpl(V1ObjectMeta item){
                    this.builder = new V1ObjectMetaBuilder(this, item);
            }
            MetadataNestedImpl(){
                    this.builder = new V1ObjectMetaBuilder(this);
            }
    
    public N and(){
            return (N) V1alpha1ClusterRoleBindingFluentImpl.this.withMetadata(builder.build());
    }
    public N endMetadata(){
            return and();
    }

}
    public class RoleRefNestedImpl extends V1alpha1RoleRefFluentImpl> implements V1alpha1ClusterRoleBindingFluent.RoleRefNested,io.kubernetes.client.fluent.Nested{

            private final V1alpha1RoleRefBuilder builder;
    
            RoleRefNestedImpl(V1alpha1RoleRef item){
                    this.builder = new V1alpha1RoleRefBuilder(this, item);
            }
            RoleRefNestedImpl(){
                    this.builder = new V1alpha1RoleRefBuilder(this);
            }
    
    public N and(){
            return (N) V1alpha1ClusterRoleBindingFluentImpl.this.withRoleRef(builder.build());
    }
    public N endRoleRef(){
            return and();
    }

}
    public class SubjectsNestedImpl extends V1alpha1SubjectFluentImpl> implements V1alpha1ClusterRoleBindingFluent.SubjectsNested,io.kubernetes.client.fluent.Nested{

            private final V1alpha1SubjectBuilder builder;
        private final int index;
    
            SubjectsNestedImpl(int index,V1alpha1Subject item){
                    this.index = index;
                    this.builder = new V1alpha1SubjectBuilder(this, item);
            }
            SubjectsNestedImpl(){
                    this.index = -1;
                    this.builder = new V1alpha1SubjectBuilder(this);
            }
    
    public N and(){
            return (N) V1alpha1ClusterRoleBindingFluentImpl.this.setToSubjects(index, builder.build());
    }
    public N endSubject(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy