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

annotations.io.alauda.kubernetes.api.model.JenkinsBindingStatusFluentImpl 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 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 io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import java.lang.Integer;
import javax.validation.Valid;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;

public class JenkinsBindingStatusFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements JenkinsBindingStatusFluent{

    private List conditions =  new ArrayList();
    private HostPortStatusBuilder http;
    private String status;

    public JenkinsBindingStatusFluentImpl(){
    }
    public JenkinsBindingStatusFluentImpl(JenkinsBindingStatus instance){
            this.withConditions(instance.getConditions()); 
            this.withHttp(instance.getHttp()); 
            this.withStatus(instance.getStatus()); 
    }

    public A addToConditions(int index,JenkinsBindingCondition item){
            JenkinsBindingConditionBuilder builder = new JenkinsBindingConditionBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.conditions.add(index >= 0 ? index : conditions.size(), builder); return (A)this;
    }

    public A setToConditions(int index,JenkinsBindingCondition item){
            JenkinsBindingConditionBuilder builder = new JenkinsBindingConditionBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= conditions.size()) { conditions.add(builder); } else { conditions.set(index, builder);}
             return (A)this;
    }

    public A addToConditions(JenkinsBindingCondition... items){
            for (JenkinsBindingCondition item : items) {JenkinsBindingConditionBuilder builder = new JenkinsBindingConditionBuilder(item);_visitables.add(builder);this.conditions.add(builder);} return (A)this;
    }

    public A addAllToConditions(Collection items){
            for (JenkinsBindingCondition item : items) {JenkinsBindingConditionBuilder builder = new JenkinsBindingConditionBuilder(item);_visitables.add(builder);this.conditions.add(builder);} return (A)this;
    }

    public A removeFromConditions(JenkinsBindingCondition... items){
            for (JenkinsBindingCondition item : items) {JenkinsBindingConditionBuilder builder = new JenkinsBindingConditionBuilder(item);_visitables.remove(builder);this.conditions.remove(builder);} return (A)this;
    }

    public A removeAllFromConditions(Collection items){
            for (JenkinsBindingCondition item : items) {JenkinsBindingConditionBuilder builder = new JenkinsBindingConditionBuilder(item);_visitables.remove(builder);this.conditions.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildConditions instead.
 */
@Deprecated public List getConditions(){
            return build(conditions);
    }

    public List buildConditions(){
            return build(conditions);
    }

    public JenkinsBindingCondition buildCondition(int index){
            return this.conditions.get(index).build();
    }

    public JenkinsBindingCondition buildFirstCondition(){
            return this.conditions.get(0).build();
    }

    public JenkinsBindingCondition buildLastCondition(){
            return this.conditions.get(conditions.size() - 1).build();
    }

    public JenkinsBindingCondition buildMatchingCondition(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (JenkinsBindingConditionBuilder item: conditions) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withConditions(List conditions){
            _visitables.removeAll(this.conditions);
            this.conditions.clear();
            if (conditions != null) {for (JenkinsBindingCondition item : conditions){this.addToConditions(item);}} return (A) this;
    }

    public A withConditions(JenkinsBindingCondition... conditions){
            this.conditions.clear(); if (conditions != null) {for (JenkinsBindingCondition item :conditions){ this.addToConditions(item);}} return (A) this;
    }

    public Boolean hasConditions(){
            return conditions!= null && !conditions.isEmpty();
    }

    public JenkinsBindingStatusFluent.ConditionsNested addNewCondition(){
            return new ConditionsNestedImpl();
    }

    public JenkinsBindingStatusFluent.ConditionsNested addNewConditionLike(JenkinsBindingCondition item){
            return new ConditionsNestedImpl(-1, item);
    }

    public JenkinsBindingStatusFluent.ConditionsNested setNewConditionLike(int index,JenkinsBindingCondition item){
            return new ConditionsNestedImpl(index, item);
    }

    public JenkinsBindingStatusFluent.ConditionsNested editCondition(int index){
            if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
            return setNewConditionLike(index, buildCondition(index));
    }

    public JenkinsBindingStatusFluent.ConditionsNested editFirstCondition(){
            if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
            return setNewConditionLike(0, buildCondition(0));
    }

    public JenkinsBindingStatusFluent.ConditionsNested editLastCondition(){
            int index = conditions.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last conditions. The list is empty.");
            return setNewConditionLike(index, buildCondition(index));
    }

    public JenkinsBindingStatusFluent.ConditionsNested editMatchingCondition(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i withNewHttp(){
            return new HttpNestedImpl();
    }

    public JenkinsBindingStatusFluent.HttpNested withNewHttpLike(HostPortStatus item){
            return new HttpNestedImpl(item);
    }

    public JenkinsBindingStatusFluent.HttpNested editHttp(){
            return withNewHttpLike(getHttp());
    }

    public JenkinsBindingStatusFluent.HttpNested editOrNewHttp(){
            return withNewHttpLike(getHttp() != null ? getHttp(): new HostPortStatusBuilder().build());
    }

    public JenkinsBindingStatusFluent.HttpNested editOrNewHttpLike(HostPortStatus item){
            return withNewHttpLike(getHttp() != null ? getHttp(): item);
    }

    public A withNewHttp(Long delay,String lastAttempt,String response,Integer statusCode,String version){
            return (A)withHttp(new HostPortStatus(delay, lastAttempt, response, statusCode, version));
    }

    public String getStatus(){
            return this.status;
    }

    public A withStatus(String status){
            this.status=status; return (A) this;
    }

    public Boolean hasStatus(){
            return this.status!=null;
    }

    public boolean equals(Object o){
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            if (!super.equals(o)) return false;
            JenkinsBindingStatusFluentImpl that = (JenkinsBindingStatusFluentImpl) o;
            if (conditions != null ? !conditions.equals(that.conditions) :that.conditions != null) return false;
            if (http != null ? !http.equals(that.http) :that.http != null) return false;
            if (status != null ? !status.equals(that.status) :that.status != null) return false;
            return true;
    }


    public class ConditionsNestedImpl extends JenkinsBindingConditionFluentImpl> implements JenkinsBindingStatusFluent.ConditionsNested,io.alauda.kubernetes.api.builder.Nested{

            private final JenkinsBindingConditionBuilder builder;
        private final int index;
    
            ConditionsNestedImpl(int index,JenkinsBindingCondition item){
                    this.index = index;
                    this.builder = new JenkinsBindingConditionBuilder(this, item);
            }
            ConditionsNestedImpl(){
                    this.index = -1;
                    this.builder = new JenkinsBindingConditionBuilder(this);
            }
    
    public N and(){
            return (N) JenkinsBindingStatusFluentImpl.this.setToConditions(index, builder.build());
    }
    public N endCondition(){
            return and();
    }

}
    public class HttpNestedImpl extends HostPortStatusFluentImpl> implements JenkinsBindingStatusFluent.HttpNested,io.alauda.kubernetes.api.builder.Nested{

            private final HostPortStatusBuilder builder;
    
            HttpNestedImpl(HostPortStatus item){
                    this.builder = new HostPortStatusBuilder(this, item);
            }
            HttpNestedImpl(){
                    this.builder = new HostPortStatusBuilder(this);
            }
    
    public N and(){
            return (N) JenkinsBindingStatusFluentImpl.this.withHttp(builder.build());
    }
    public N endHttp(){
            return and();
    }

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy