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

annotations.io.alauda.kubernetes.api.model.PodAntiAffinityFluentImpl Maven / Gradle / Ivy

There is a newer version: 0.2.12
Show newest version
package io.alauda.kubernetes.api.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.alauda.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import io.alauda.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;

public class PodAntiAffinityFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements PodAntiAffinityFluent{

    private List preferredDuringSchedulingIgnoredDuringExecution =  new ArrayList();
    private List requiredDuringSchedulingIgnoredDuringExecution =  new ArrayList();

    public PodAntiAffinityFluentImpl(){
    }
    public PodAntiAffinityFluentImpl(PodAntiAffinity instance){
            this.withPreferredDuringSchedulingIgnoredDuringExecution(instance.getPreferredDuringSchedulingIgnoredDuringExecution()); 
            this.withRequiredDuringSchedulingIgnoredDuringExecution(instance.getRequiredDuringSchedulingIgnoredDuringExecution()); 
    }

    public A addToPreferredDuringSchedulingIgnoredDuringExecution(int index,WeightedPodAffinityTerm item){
            WeightedPodAffinityTermBuilder builder = new WeightedPodAffinityTermBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.preferredDuringSchedulingIgnoredDuringExecution.add(index >= 0 ? index : preferredDuringSchedulingIgnoredDuringExecution.size(), builder); return (A)this;
    }

    public A setToPreferredDuringSchedulingIgnoredDuringExecution(int index,WeightedPodAffinityTerm item){
            WeightedPodAffinityTermBuilder builder = new WeightedPodAffinityTermBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= preferredDuringSchedulingIgnoredDuringExecution.size()) { preferredDuringSchedulingIgnoredDuringExecution.add(builder); } else { preferredDuringSchedulingIgnoredDuringExecution.set(index, builder);}
             return (A)this;
    }

    public A addToPreferredDuringSchedulingIgnoredDuringExecution(WeightedPodAffinityTerm... items){
            for (WeightedPodAffinityTerm item : items) {WeightedPodAffinityTermBuilder builder = new WeightedPodAffinityTermBuilder(item);_visitables.add(builder);this.preferredDuringSchedulingIgnoredDuringExecution.add(builder);} return (A)this;
    }

    public A addAllToPreferredDuringSchedulingIgnoredDuringExecution(Collection items){
            for (WeightedPodAffinityTerm item : items) {WeightedPodAffinityTermBuilder builder = new WeightedPodAffinityTermBuilder(item);_visitables.add(builder);this.preferredDuringSchedulingIgnoredDuringExecution.add(builder);} return (A)this;
    }

    public A removeFromPreferredDuringSchedulingIgnoredDuringExecution(WeightedPodAffinityTerm... items){
            for (WeightedPodAffinityTerm item : items) {WeightedPodAffinityTermBuilder builder = new WeightedPodAffinityTermBuilder(item);_visitables.remove(builder);this.preferredDuringSchedulingIgnoredDuringExecution.remove(builder);} return (A)this;
    }

    public A removeAllFromPreferredDuringSchedulingIgnoredDuringExecution(Collection items){
            for (WeightedPodAffinityTerm item : items) {WeightedPodAffinityTermBuilder builder = new WeightedPodAffinityTermBuilder(item);_visitables.remove(builder);this.preferredDuringSchedulingIgnoredDuringExecution.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildPreferredDuringSchedulingIgnoredDuringExecution instead.
 */
@Deprecated public List getPreferredDuringSchedulingIgnoredDuringExecution(){
            return build(preferredDuringSchedulingIgnoredDuringExecution);
    }

    public List buildPreferredDuringSchedulingIgnoredDuringExecution(){
            return build(preferredDuringSchedulingIgnoredDuringExecution);
    }

    public WeightedPodAffinityTerm buildPreferredDuringSchedulingIgnoredDuringExecution(int index){
            return this.preferredDuringSchedulingIgnoredDuringExecution.get(index).build();
    }

    public WeightedPodAffinityTerm buildFirstPreferredDuringSchedulingIgnoredDuringExecution(){
            return this.preferredDuringSchedulingIgnoredDuringExecution.get(0).build();
    }

    public WeightedPodAffinityTerm buildLastPreferredDuringSchedulingIgnoredDuringExecution(){
            return this.preferredDuringSchedulingIgnoredDuringExecution.get(preferredDuringSchedulingIgnoredDuringExecution.size() - 1).build();
    }

    public WeightedPodAffinityTerm buildMatchingPreferredDuringSchedulingIgnoredDuringExecution(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (WeightedPodAffinityTermBuilder item: preferredDuringSchedulingIgnoredDuringExecution) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withPreferredDuringSchedulingIgnoredDuringExecution(List preferredDuringSchedulingIgnoredDuringExecution){
            _visitables.removeAll(this.preferredDuringSchedulingIgnoredDuringExecution);
            this.preferredDuringSchedulingIgnoredDuringExecution.clear();
            if (preferredDuringSchedulingIgnoredDuringExecution != null) {for (WeightedPodAffinityTerm item : preferredDuringSchedulingIgnoredDuringExecution){this.addToPreferredDuringSchedulingIgnoredDuringExecution(item);}} return (A) this;
    }

    public A withPreferredDuringSchedulingIgnoredDuringExecution(WeightedPodAffinityTerm... preferredDuringSchedulingIgnoredDuringExecution){
            this.preferredDuringSchedulingIgnoredDuringExecution.clear(); if (preferredDuringSchedulingIgnoredDuringExecution != null) {for (WeightedPodAffinityTerm item :preferredDuringSchedulingIgnoredDuringExecution){ this.addToPreferredDuringSchedulingIgnoredDuringExecution(item);}} return (A) this;
    }

    public Boolean hasPreferredDuringSchedulingIgnoredDuringExecution(){
            return preferredDuringSchedulingIgnoredDuringExecution!= null && !preferredDuringSchedulingIgnoredDuringExecution.isEmpty();
    }

    public PodAntiAffinityFluent.PreferredDuringSchedulingIgnoredDuringExecutionNested addNewPreferredDuringSchedulingIgnoredDuringExecution(){
            return new PreferredDuringSchedulingIgnoredDuringExecutionNestedImpl();
    }

    public PodAntiAffinityFluent.PreferredDuringSchedulingIgnoredDuringExecutionNested addNewPreferredDuringSchedulingIgnoredDuringExecutionLike(WeightedPodAffinityTerm item){
            return new PreferredDuringSchedulingIgnoredDuringExecutionNestedImpl(-1, item);
    }

    public PodAntiAffinityFluent.PreferredDuringSchedulingIgnoredDuringExecutionNested setNewPreferredDuringSchedulingIgnoredDuringExecutionLike(int index,WeightedPodAffinityTerm item){
            return new PreferredDuringSchedulingIgnoredDuringExecutionNestedImpl(index, item);
    }

    public PodAntiAffinityFluent.PreferredDuringSchedulingIgnoredDuringExecutionNested editPreferredDuringSchedulingIgnoredDuringExecution(int index){
            if (preferredDuringSchedulingIgnoredDuringExecution.size() <= index) throw new RuntimeException("Can't edit preferredDuringSchedulingIgnoredDuringExecution. Index exceeds size.");
            return setNewPreferredDuringSchedulingIgnoredDuringExecutionLike(index, buildPreferredDuringSchedulingIgnoredDuringExecution(index));
    }

    public PodAntiAffinityFluent.PreferredDuringSchedulingIgnoredDuringExecutionNested editFirstPreferredDuringSchedulingIgnoredDuringExecution(){
            if (preferredDuringSchedulingIgnoredDuringExecution.size() == 0) throw new RuntimeException("Can't edit first preferredDuringSchedulingIgnoredDuringExecution. The list is empty.");
            return setNewPreferredDuringSchedulingIgnoredDuringExecutionLike(0, buildPreferredDuringSchedulingIgnoredDuringExecution(0));
    }

    public PodAntiAffinityFluent.PreferredDuringSchedulingIgnoredDuringExecutionNested editLastPreferredDuringSchedulingIgnoredDuringExecution(){
            int index = preferredDuringSchedulingIgnoredDuringExecution.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last preferredDuringSchedulingIgnoredDuringExecution. The list is empty.");
            return setNewPreferredDuringSchedulingIgnoredDuringExecutionLike(index, buildPreferredDuringSchedulingIgnoredDuringExecution(index));
    }

    public PodAntiAffinityFluent.PreferredDuringSchedulingIgnoredDuringExecutionNested editMatchingPreferredDuringSchedulingIgnoredDuringExecution(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i= 0 ? index : _visitables.size(), builder);this.requiredDuringSchedulingIgnoredDuringExecution.add(index >= 0 ? index : requiredDuringSchedulingIgnoredDuringExecution.size(), builder); return (A)this;
    }

    public A setToRequiredDuringSchedulingIgnoredDuringExecution(int index,PodAffinityTerm item){
            PodAffinityTermBuilder builder = new PodAffinityTermBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= requiredDuringSchedulingIgnoredDuringExecution.size()) { requiredDuringSchedulingIgnoredDuringExecution.add(builder); } else { requiredDuringSchedulingIgnoredDuringExecution.set(index, builder);}
             return (A)this;
    }

    public A addToRequiredDuringSchedulingIgnoredDuringExecution(PodAffinityTerm... items){
            for (PodAffinityTerm item : items) {PodAffinityTermBuilder builder = new PodAffinityTermBuilder(item);_visitables.add(builder);this.requiredDuringSchedulingIgnoredDuringExecution.add(builder);} return (A)this;
    }

    public A addAllToRequiredDuringSchedulingIgnoredDuringExecution(Collection items){
            for (PodAffinityTerm item : items) {PodAffinityTermBuilder builder = new PodAffinityTermBuilder(item);_visitables.add(builder);this.requiredDuringSchedulingIgnoredDuringExecution.add(builder);} return (A)this;
    }

    public A removeFromRequiredDuringSchedulingIgnoredDuringExecution(PodAffinityTerm... items){
            for (PodAffinityTerm item : items) {PodAffinityTermBuilder builder = new PodAffinityTermBuilder(item);_visitables.remove(builder);this.requiredDuringSchedulingIgnoredDuringExecution.remove(builder);} return (A)this;
    }

    public A removeAllFromRequiredDuringSchedulingIgnoredDuringExecution(Collection items){
            for (PodAffinityTerm item : items) {PodAffinityTermBuilder builder = new PodAffinityTermBuilder(item);_visitables.remove(builder);this.requiredDuringSchedulingIgnoredDuringExecution.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildRequiredDuringSchedulingIgnoredDuringExecution instead.
 */
@Deprecated public List getRequiredDuringSchedulingIgnoredDuringExecution(){
            return build(requiredDuringSchedulingIgnoredDuringExecution);
    }

    public List buildRequiredDuringSchedulingIgnoredDuringExecution(){
            return build(requiredDuringSchedulingIgnoredDuringExecution);
    }

    public PodAffinityTerm buildRequiredDuringSchedulingIgnoredDuringExecution(int index){
            return this.requiredDuringSchedulingIgnoredDuringExecution.get(index).build();
    }

    public PodAffinityTerm buildFirstRequiredDuringSchedulingIgnoredDuringExecution(){
            return this.requiredDuringSchedulingIgnoredDuringExecution.get(0).build();
    }

    public PodAffinityTerm buildLastRequiredDuringSchedulingIgnoredDuringExecution(){
            return this.requiredDuringSchedulingIgnoredDuringExecution.get(requiredDuringSchedulingIgnoredDuringExecution.size() - 1).build();
    }

    public PodAffinityTerm buildMatchingRequiredDuringSchedulingIgnoredDuringExecution(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (PodAffinityTermBuilder item: requiredDuringSchedulingIgnoredDuringExecution) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withRequiredDuringSchedulingIgnoredDuringExecution(List requiredDuringSchedulingIgnoredDuringExecution){
            _visitables.removeAll(this.requiredDuringSchedulingIgnoredDuringExecution);
            this.requiredDuringSchedulingIgnoredDuringExecution.clear();
            if (requiredDuringSchedulingIgnoredDuringExecution != null) {for (PodAffinityTerm item : requiredDuringSchedulingIgnoredDuringExecution){this.addToRequiredDuringSchedulingIgnoredDuringExecution(item);}} return (A) this;
    }

    public A withRequiredDuringSchedulingIgnoredDuringExecution(PodAffinityTerm... requiredDuringSchedulingIgnoredDuringExecution){
            this.requiredDuringSchedulingIgnoredDuringExecution.clear(); if (requiredDuringSchedulingIgnoredDuringExecution != null) {for (PodAffinityTerm item :requiredDuringSchedulingIgnoredDuringExecution){ this.addToRequiredDuringSchedulingIgnoredDuringExecution(item);}} return (A) this;
    }

    public Boolean hasRequiredDuringSchedulingIgnoredDuringExecution(){
            return requiredDuringSchedulingIgnoredDuringExecution!= null && !requiredDuringSchedulingIgnoredDuringExecution.isEmpty();
    }

    public PodAntiAffinityFluent.RequiredDuringSchedulingIgnoredDuringExecutionNested addNewRequiredDuringSchedulingIgnoredDuringExecution(){
            return new RequiredDuringSchedulingIgnoredDuringExecutionNestedImpl();
    }

    public PodAntiAffinityFluent.RequiredDuringSchedulingIgnoredDuringExecutionNested addNewRequiredDuringSchedulingIgnoredDuringExecutionLike(PodAffinityTerm item){
            return new RequiredDuringSchedulingIgnoredDuringExecutionNestedImpl(-1, item);
    }

    public PodAntiAffinityFluent.RequiredDuringSchedulingIgnoredDuringExecutionNested setNewRequiredDuringSchedulingIgnoredDuringExecutionLike(int index,PodAffinityTerm item){
            return new RequiredDuringSchedulingIgnoredDuringExecutionNestedImpl(index, item);
    }

    public PodAntiAffinityFluent.RequiredDuringSchedulingIgnoredDuringExecutionNested editRequiredDuringSchedulingIgnoredDuringExecution(int index){
            if (requiredDuringSchedulingIgnoredDuringExecution.size() <= index) throw new RuntimeException("Can't edit requiredDuringSchedulingIgnoredDuringExecution. Index exceeds size.");
            return setNewRequiredDuringSchedulingIgnoredDuringExecutionLike(index, buildRequiredDuringSchedulingIgnoredDuringExecution(index));
    }

    public PodAntiAffinityFluent.RequiredDuringSchedulingIgnoredDuringExecutionNested editFirstRequiredDuringSchedulingIgnoredDuringExecution(){
            if (requiredDuringSchedulingIgnoredDuringExecution.size() == 0) throw new RuntimeException("Can't edit first requiredDuringSchedulingIgnoredDuringExecution. The list is empty.");
            return setNewRequiredDuringSchedulingIgnoredDuringExecutionLike(0, buildRequiredDuringSchedulingIgnoredDuringExecution(0));
    }

    public PodAntiAffinityFluent.RequiredDuringSchedulingIgnoredDuringExecutionNested editLastRequiredDuringSchedulingIgnoredDuringExecution(){
            int index = requiredDuringSchedulingIgnoredDuringExecution.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last requiredDuringSchedulingIgnoredDuringExecution. The list is empty.");
            return setNewRequiredDuringSchedulingIgnoredDuringExecutionLike(index, buildRequiredDuringSchedulingIgnoredDuringExecution(index));
    }

    public PodAntiAffinityFluent.RequiredDuringSchedulingIgnoredDuringExecutionNested editMatchingRequiredDuringSchedulingIgnoredDuringExecution(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends WeightedPodAffinityTermFluentImpl> implements PodAntiAffinityFluent.PreferredDuringSchedulingIgnoredDuringExecutionNested,io.alauda.kubernetes.api.builder.Nested{

            private final WeightedPodAffinityTermBuilder builder;
        private final int index;
    
            PreferredDuringSchedulingIgnoredDuringExecutionNestedImpl(int index,WeightedPodAffinityTerm item){
                    this.index = index;
                    this.builder = new WeightedPodAffinityTermBuilder(this, item);
            }
            PreferredDuringSchedulingIgnoredDuringExecutionNestedImpl(){
                    this.index = -1;
                    this.builder = new WeightedPodAffinityTermBuilder(this);
            }
    
    public N and(){
            return (N) PodAntiAffinityFluentImpl.this.setToPreferredDuringSchedulingIgnoredDuringExecution(index, builder.build());
    }
    public N endPreferredDuringSchedulingIgnoredDuringExecution(){
            return and();
    }

}
    public class RequiredDuringSchedulingIgnoredDuringExecutionNestedImpl extends PodAffinityTermFluentImpl> implements PodAntiAffinityFluent.RequiredDuringSchedulingIgnoredDuringExecutionNested,io.alauda.kubernetes.api.builder.Nested{

            private final PodAffinityTermBuilder builder;
        private final int index;
    
            RequiredDuringSchedulingIgnoredDuringExecutionNestedImpl(int index,PodAffinityTerm item){
                    this.index = index;
                    this.builder = new PodAffinityTermBuilder(this, item);
            }
            RequiredDuringSchedulingIgnoredDuringExecutionNestedImpl(){
                    this.index = -1;
                    this.builder = new PodAffinityTermBuilder(this);
            }
    
    public N and(){
            return (N) PodAntiAffinityFluentImpl.this.setToRequiredDuringSchedulingIgnoredDuringExecution(index, builder.build());
    }
    public N endRequiredDuringSchedulingIgnoredDuringExecution(){
            return and();
    }

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy