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

io.kubernetes.client.models.V1beta1CronJobStatusFluentImpl 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 org.joda.time.DateTime;
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 V1beta1CronJobStatusFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1beta1CronJobStatusFluent{

    private List active;
    private DateTime lastScheduleTime;

    public V1beta1CronJobStatusFluentImpl(){
    }
    public V1beta1CronJobStatusFluentImpl(V1beta1CronJobStatus instance){
            this.withActive(instance.getActive());

            this.withLastScheduleTime(instance.getLastScheduleTime());

    }

    public A addToActive(int index,V1ObjectReference item){
            if (this.active == null) {this.active = new ArrayList();}
            V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.active.add(index >= 0 ? index : active.size(), builder); return (A)this;
    }

    public A setToActive(int index,V1ObjectReference item){
            if (this.active == null) {this.active = new ArrayList();}
            V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= active.size()) { active.add(builder); } else { active.set(index, builder);}
             return (A)this;
    }

    public A addToActive(V1ObjectReference... items){
            if (this.active == null) {this.active = new ArrayList();}
            for (V1ObjectReference item : items) {V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);_visitables.add(builder);this.active.add(builder);} return (A)this;
    }

    public A addAllToActive(Collection items){
            if (this.active == null) {this.active = new ArrayList();}
            for (V1ObjectReference item : items) {V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);_visitables.add(builder);this.active.add(builder);} return (A)this;
    }

    public A removeFromActive(V1ObjectReference... items){
            for (V1ObjectReference item : items) {V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);_visitables.remove(builder);if (this.active != null) {this.active.remove(builder);}} return (A)this;
    }

    public A removeAllFromActive(Collection items){
            for (V1ObjectReference item : items) {V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);_visitables.remove(builder);if (this.active != null) {this.active.remove(builder);}} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildActive instead.
 */
@Deprecated public List getActive(){
            return build(active);
    }

    public List buildActive(){
            return build(active);
    }

    public V1ObjectReference buildActive(int index){
            return this.active.get(index).build();
    }

    public V1ObjectReference buildFirstActive(){
            return this.active.get(0).build();
    }

    public V1ObjectReference buildLastActive(){
            return this.active.get(active.size() - 1).build();
    }

    public V1ObjectReference buildMatchingActive(io.kubernetes.client.fluent.Predicate predicate){
            for (V1ObjectReferenceBuilder item: active) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withActive(List active){
            if (this.active != null) { _visitables.removeAll(this.active);}
            if (active != null) {this.active = new ArrayList(); for (V1ObjectReference item : active){this.addToActive(item);}} else { this.active = null;} return (A) this;
    }

    public A withActive(V1ObjectReference... active){
            this.active.clear(); if (active != null) {for (V1ObjectReference item :active){ this.addToActive(item);}} return (A) this;
    }

    public Boolean hasActive(){
            return active != null && !active.isEmpty();
    }

    public V1beta1CronJobStatusFluent.ActiveNested addNewActive(){
            return new ActiveNestedImpl();
    }

    public V1beta1CronJobStatusFluent.ActiveNested addNewActiveLike(V1ObjectReference item){
            return new ActiveNestedImpl(-1, item);
    }

    public V1beta1CronJobStatusFluent.ActiveNested setNewActiveLike(int index,V1ObjectReference item){
            return new ActiveNestedImpl(index, item);
    }

    public V1beta1CronJobStatusFluent.ActiveNested editActive(int index){
            if (active.size() <= index) throw new RuntimeException("Can't edit active. Index exceeds size.");
            return setNewActiveLike(index, buildActive(index));
    }

    public V1beta1CronJobStatusFluent.ActiveNested editFirstActive(){
            if (active.size() == 0) throw new RuntimeException("Can't edit first active. The list is empty.");
            return setNewActiveLike(0, buildActive(0));
    }

    public V1beta1CronJobStatusFluent.ActiveNested editLastActive(){
            int index = active.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last active. The list is empty.");
            return setNewActiveLike(index, buildActive(index));
    }

    public V1beta1CronJobStatusFluent.ActiveNested editMatchingActive(io.kubernetes.client.fluent.Predicate predicate){
            int index = -1;
            for (int i=0;i extends V1ObjectReferenceFluentImpl> implements V1beta1CronJobStatusFluent.ActiveNested,io.kubernetes.client.fluent.Nested{

            private final V1ObjectReferenceBuilder builder;
        private final int index;
    
            ActiveNestedImpl(int index,V1ObjectReference item){
                    this.index = index;
                    this.builder = new V1ObjectReferenceBuilder(this, item);
            }
            ActiveNestedImpl(){
                    this.index = -1;
                    this.builder = new V1ObjectReferenceBuilder(this);
            }
    
    public N and(){
            return (N) V1beta1CronJobStatusFluentImpl.this.setToActive(index, builder.build());
    }
    public N endActive(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy