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

io.alauda.kubernetes.api.model.CronJobStatusFluentImpl 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 java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import javax.validation.Valid;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;

public class CronJobStatusFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements CronJobStatusFluent{

    private List active =  new ArrayList();
    private String lastScheduleTime;

    public CronJobStatusFluentImpl(){
    }
    public CronJobStatusFluentImpl(CronJobStatus instance){
            this.withActive(instance.getActive()); 
            this.withLastScheduleTime(instance.getLastScheduleTime()); 
    }

    public A addToActive(int index,ObjectReference item){
            ObjectReferenceBuilder builder = new ObjectReferenceBuilder(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,ObjectReference item){
            ObjectReferenceBuilder builder = new ObjectReferenceBuilder(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(ObjectReference... items){
            for (ObjectReference item : items) {ObjectReferenceBuilder builder = new ObjectReferenceBuilder(item);_visitables.add(builder);this.active.add(builder);} return (A)this;
    }

    public A addAllToActive(Collection items){
            for (ObjectReference item : items) {ObjectReferenceBuilder builder = new ObjectReferenceBuilder(item);_visitables.add(builder);this.active.add(builder);} return (A)this;
    }

    public A removeFromActive(ObjectReference... items){
            for (ObjectReference item : items) {ObjectReferenceBuilder builder = new ObjectReferenceBuilder(item);_visitables.remove(builder);this.active.remove(builder);} return (A)this;
    }

    public A removeAllFromActive(Collection items){
            for (ObjectReference item : items) {ObjectReferenceBuilder builder = new ObjectReferenceBuilder(item);_visitables.remove(builder);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 ObjectReference buildActive(int index){
            return this.active.get(index).build();
    }

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

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

    public ObjectReference buildMatchingActive(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (ObjectReferenceBuilder item: active) { if(predicate.apply(item)){return item.build();} } return null;
    }

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

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

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

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

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

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

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

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

    public CronJobStatusFluent.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 CronJobStatusFluent.ActiveNested editMatchingActive(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends ObjectReferenceFluentImpl> implements CronJobStatusFluent.ActiveNested,io.alauda.kubernetes.api.builder.Nested{

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

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy