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

io.kubernetes.client.models.V1beta1MutatingWebhookConfigurationFluentImpl 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 V1beta1MutatingWebhookConfigurationFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1beta1MutatingWebhookConfigurationFluent{

    private String apiVersion;
    private String kind;
    private V1ObjectMetaBuilder metadata;
    private List webhooks;

    public V1beta1MutatingWebhookConfigurationFluentImpl(){
    }
    public V1beta1MutatingWebhookConfigurationFluentImpl(V1beta1MutatingWebhookConfiguration instance){
            this.withApiVersion(instance.getApiVersion());

            this.withKind(instance.getKind());

            this.withMetadata(instance.getMetadata());

            this.withWebhooks(instance.getWebhooks());

    }

    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 V1beta1MutatingWebhookConfigurationFluent.MetadataNested withNewMetadata(){
            return new MetadataNestedImpl();
    }

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

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

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

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

    public A addToWebhooks(int index,V1beta1Webhook item){
            if (this.webhooks == null) {this.webhooks = new ArrayList();}
            V1beta1WebhookBuilder builder = new V1beta1WebhookBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.webhooks.add(index >= 0 ? index : webhooks.size(), builder); return (A)this;
    }

    public A setToWebhooks(int index,V1beta1Webhook item){
            if (this.webhooks == null) {this.webhooks = new ArrayList();}
            V1beta1WebhookBuilder builder = new V1beta1WebhookBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= webhooks.size()) { webhooks.add(builder); } else { webhooks.set(index, builder);}
             return (A)this;
    }

    public A addToWebhooks(V1beta1Webhook... items){
            if (this.webhooks == null) {this.webhooks = new ArrayList();}
            for (V1beta1Webhook item : items) {V1beta1WebhookBuilder builder = new V1beta1WebhookBuilder(item);_visitables.add(builder);this.webhooks.add(builder);} return (A)this;
    }

    public A addAllToWebhooks(Collection items){
            if (this.webhooks == null) {this.webhooks = new ArrayList();}
            for (V1beta1Webhook item : items) {V1beta1WebhookBuilder builder = new V1beta1WebhookBuilder(item);_visitables.add(builder);this.webhooks.add(builder);} return (A)this;
    }

    public A removeFromWebhooks(V1beta1Webhook... items){
            for (V1beta1Webhook item : items) {V1beta1WebhookBuilder builder = new V1beta1WebhookBuilder(item);_visitables.remove(builder);if (this.webhooks != null) {this.webhooks.remove(builder);}} return (A)this;
    }

    public A removeAllFromWebhooks(Collection items){
            for (V1beta1Webhook item : items) {V1beta1WebhookBuilder builder = new V1beta1WebhookBuilder(item);_visitables.remove(builder);if (this.webhooks != null) {this.webhooks.remove(builder);}} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildWebhooks instead.
 */
@Deprecated public List getWebhooks(){
            return build(webhooks);
    }

    public List buildWebhooks(){
            return build(webhooks);
    }

    public V1beta1Webhook buildWebhook(int index){
            return this.webhooks.get(index).build();
    }

    public V1beta1Webhook buildFirstWebhook(){
            return this.webhooks.get(0).build();
    }

    public V1beta1Webhook buildLastWebhook(){
            return this.webhooks.get(webhooks.size() - 1).build();
    }

    public V1beta1Webhook buildMatchingWebhook(io.kubernetes.client.fluent.Predicate predicate){
            for (V1beta1WebhookBuilder item: webhooks) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withWebhooks(List webhooks){
            if (this.webhooks != null) { _visitables.removeAll(this.webhooks);}
            if (webhooks != null) {this.webhooks = new ArrayList(); for (V1beta1Webhook item : webhooks){this.addToWebhooks(item);}} else { this.webhooks = null;} return (A) this;
    }

    public A withWebhooks(V1beta1Webhook... webhooks){
            this.webhooks.clear(); if (webhooks != null) {for (V1beta1Webhook item :webhooks){ this.addToWebhooks(item);}} return (A) this;
    }

    public Boolean hasWebhooks(){
            return webhooks != null && !webhooks.isEmpty();
    }

    public V1beta1MutatingWebhookConfigurationFluent.WebhooksNested addNewWebhook(){
            return new WebhooksNestedImpl();
    }

    public V1beta1MutatingWebhookConfigurationFluent.WebhooksNested addNewWebhookLike(V1beta1Webhook item){
            return new WebhooksNestedImpl(-1, item);
    }

    public V1beta1MutatingWebhookConfigurationFluent.WebhooksNested setNewWebhookLike(int index,V1beta1Webhook item){
            return new WebhooksNestedImpl(index, item);
    }

    public V1beta1MutatingWebhookConfigurationFluent.WebhooksNested editWebhook(int index){
            if (webhooks.size() <= index) throw new RuntimeException("Can't edit webhooks. Index exceeds size.");
            return setNewWebhookLike(index, buildWebhook(index));
    }

    public V1beta1MutatingWebhookConfigurationFluent.WebhooksNested editFirstWebhook(){
            if (webhooks.size() == 0) throw new RuntimeException("Can't edit first webhooks. The list is empty.");
            return setNewWebhookLike(0, buildWebhook(0));
    }

    public V1beta1MutatingWebhookConfigurationFluent.WebhooksNested editLastWebhook(){
            int index = webhooks.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last webhooks. The list is empty.");
            return setNewWebhookLike(index, buildWebhook(index));
    }

    public V1beta1MutatingWebhookConfigurationFluent.WebhooksNested editMatchingWebhook(io.kubernetes.client.fluent.Predicate predicate){
            int index = -1;
            for (int i=0;i extends V1ObjectMetaFluentImpl> implements V1beta1MutatingWebhookConfigurationFluent.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) V1beta1MutatingWebhookConfigurationFluentImpl.this.withMetadata(builder.build());
    }
    public N endMetadata(){
            return and();
    }

}
    public class WebhooksNestedImpl extends V1beta1WebhookFluentImpl> implements V1beta1MutatingWebhookConfigurationFluent.WebhooksNested,io.kubernetes.client.fluent.Nested{

            private final V1beta1WebhookBuilder builder;
        private final int index;
    
            WebhooksNestedImpl(int index,V1beta1Webhook item){
                    this.index = index;
                    this.builder = new V1beta1WebhookBuilder(this, item);
            }
            WebhooksNestedImpl(){
                    this.index = -1;
                    this.builder = new V1beta1WebhookBuilder(this);
            }
    
    public N and(){
            return (N) V1beta1MutatingWebhookConfigurationFluentImpl.this.setToWebhooks(index, builder.build());
    }
    public N endWebhook(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy