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

io.alauda.kubernetes.api.model.PipelineTemplateTaskInstanceSpecFluentImpl 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 javax.validation.Valid;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;

public class PipelineTemplateTaskInstanceSpecFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements PipelineTemplateTaskInstanceSpecFluent{

    private JenkinsAgentBuilder agent;
    private PipelineTaskApproveBuilder approve;
    private List arguments =  new ArrayList();
    private String body;
    private String engine;
    private List environments =  new ArrayList();
    private List exports =  new ArrayList();
    private PipelineTaskOptionBuilder options;
    private String type;

    public PipelineTemplateTaskInstanceSpecFluentImpl(){
    }
    public PipelineTemplateTaskInstanceSpecFluentImpl(PipelineTemplateTaskInstanceSpec instance){
            this.withAgent(instance.getAgent()); 
            this.withApprove(instance.getApprove()); 
            this.withArguments(instance.getArguments()); 
            this.withBody(instance.getBody()); 
            this.withEngine(instance.getEngine()); 
            this.withEnvironments(instance.getEnvironments()); 
            this.withExports(instance.getExports()); 
            this.withOptions(instance.getOptions()); 
            this.withType(instance.getType()); 
    }

    
/**
 * This method has been deprecated, please use method buildAgent instead.
 */
@Deprecated public JenkinsAgent getAgent(){
            return this.agent!=null?this.agent.build():null;
    }

    public JenkinsAgent buildAgent(){
            return this.agent!=null?this.agent.build():null;
    }

    public A withAgent(JenkinsAgent agent){
            _visitables.remove(this.agent);
            if (agent!=null){ this.agent= new JenkinsAgentBuilder(agent); _visitables.add(this.agent);} return (A) this;
    }

    public Boolean hasAgent(){
            return this.agent!=null;
    }

    public PipelineTemplateTaskInstanceSpecFluent.AgentNested withNewAgent(){
            return new AgentNestedImpl();
    }

    public PipelineTemplateTaskInstanceSpecFluent.AgentNested withNewAgentLike(JenkinsAgent item){
            return new AgentNestedImpl(item);
    }

    public PipelineTemplateTaskInstanceSpecFluent.AgentNested editAgent(){
            return withNewAgentLike(getAgent());
    }

    public PipelineTemplateTaskInstanceSpecFluent.AgentNested editOrNewAgent(){
            return withNewAgentLike(getAgent() != null ? getAgent(): new JenkinsAgentBuilder().build());
    }

    public PipelineTemplateTaskInstanceSpecFluent.AgentNested editOrNewAgentLike(JenkinsAgent item){
            return withNewAgentLike(getAgent() != null ? getAgent(): item);
    }

    public A withNewAgent(String label){
            return (A)withAgent(new JenkinsAgent(label));
    }

    
/**
 * This method has been deprecated, please use method buildApprove instead.
 */
@Deprecated public PipelineTaskApprove getApprove(){
            return this.approve!=null?this.approve.build():null;
    }

    public PipelineTaskApprove buildApprove(){
            return this.approve!=null?this.approve.build():null;
    }

    public A withApprove(PipelineTaskApprove approve){
            _visitables.remove(this.approve);
            if (approve!=null){ this.approve= new PipelineTaskApproveBuilder(approve); _visitables.add(this.approve);} return (A) this;
    }

    public Boolean hasApprove(){
            return this.approve!=null;
    }

    public PipelineTemplateTaskInstanceSpecFluent.ApproveNested withNewApprove(){
            return new ApproveNestedImpl();
    }

    public PipelineTemplateTaskInstanceSpecFluent.ApproveNested withNewApproveLike(PipelineTaskApprove item){
            return new ApproveNestedImpl(item);
    }

    public PipelineTemplateTaskInstanceSpecFluent.ApproveNested editApprove(){
            return withNewApproveLike(getApprove());
    }

    public PipelineTemplateTaskInstanceSpecFluent.ApproveNested editOrNewApprove(){
            return withNewApproveLike(getApprove() != null ? getApprove(): new PipelineTaskApproveBuilder().build());
    }

    public PipelineTemplateTaskInstanceSpecFluent.ApproveNested editOrNewApproveLike(PipelineTaskApprove item){
            return withNewApproveLike(getApprove() != null ? getApprove(): item);
    }

    public A withNewApprove(String message,Long timeout){
            return (A)withApprove(new PipelineTaskApprove(message, timeout));
    }

    public A addToArguments(int index,PipelineTemplateArgument item){
            PipelineTemplateArgumentBuilder builder = new PipelineTemplateArgumentBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.arguments.add(index >= 0 ? index : arguments.size(), builder); return (A)this;
    }

    public A setToArguments(int index,PipelineTemplateArgument item){
            PipelineTemplateArgumentBuilder builder = new PipelineTemplateArgumentBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= arguments.size()) { arguments.add(builder); } else { arguments.set(index, builder);}
             return (A)this;
    }

    public A addToArguments(PipelineTemplateArgument... items){
            for (PipelineTemplateArgument item : items) {PipelineTemplateArgumentBuilder builder = new PipelineTemplateArgumentBuilder(item);_visitables.add(builder);this.arguments.add(builder);} return (A)this;
    }

    public A addAllToArguments(Collection items){
            for (PipelineTemplateArgument item : items) {PipelineTemplateArgumentBuilder builder = new PipelineTemplateArgumentBuilder(item);_visitables.add(builder);this.arguments.add(builder);} return (A)this;
    }

    public A removeFromArguments(PipelineTemplateArgument... items){
            for (PipelineTemplateArgument item : items) {PipelineTemplateArgumentBuilder builder = new PipelineTemplateArgumentBuilder(item);_visitables.remove(builder);this.arguments.remove(builder);} return (A)this;
    }

    public A removeAllFromArguments(Collection items){
            for (PipelineTemplateArgument item : items) {PipelineTemplateArgumentBuilder builder = new PipelineTemplateArgumentBuilder(item);_visitables.remove(builder);this.arguments.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildArguments instead.
 */
@Deprecated public List getArguments(){
            return build(arguments);
    }

    public List buildArguments(){
            return build(arguments);
    }

    public PipelineTemplateArgument buildArgument(int index){
            return this.arguments.get(index).build();
    }

    public PipelineTemplateArgument buildFirstArgument(){
            return this.arguments.get(0).build();
    }

    public PipelineTemplateArgument buildLastArgument(){
            return this.arguments.get(arguments.size() - 1).build();
    }

    public PipelineTemplateArgument buildMatchingArgument(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (PipelineTemplateArgumentBuilder item: arguments) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withArguments(List arguments){
            _visitables.removeAll(this.arguments);
            this.arguments.clear();
            if (arguments != null) {for (PipelineTemplateArgument item : arguments){this.addToArguments(item);}} return (A) this;
    }

    public A withArguments(PipelineTemplateArgument... arguments){
            this.arguments.clear(); if (arguments != null) {for (PipelineTemplateArgument item :arguments){ this.addToArguments(item);}} return (A) this;
    }

    public Boolean hasArguments(){
            return arguments!= null && !arguments.isEmpty();
    }

    public PipelineTemplateTaskInstanceSpecFluent.ArgumentsNested addNewArgument(){
            return new ArgumentsNestedImpl();
    }

    public PipelineTemplateTaskInstanceSpecFluent.ArgumentsNested addNewArgumentLike(PipelineTemplateArgument item){
            return new ArgumentsNestedImpl(-1, item);
    }

    public PipelineTemplateTaskInstanceSpecFluent.ArgumentsNested setNewArgumentLike(int index,PipelineTemplateArgument item){
            return new ArgumentsNestedImpl(index, item);
    }

    public PipelineTemplateTaskInstanceSpecFluent.ArgumentsNested editArgument(int index){
            if (arguments.size() <= index) throw new RuntimeException("Can't edit arguments. Index exceeds size.");
            return setNewArgumentLike(index, buildArgument(index));
    }

    public PipelineTemplateTaskInstanceSpecFluent.ArgumentsNested editFirstArgument(){
            if (arguments.size() == 0) throw new RuntimeException("Can't edit first arguments. The list is empty.");
            return setNewArgumentLike(0, buildArgument(0));
    }

    public PipelineTemplateTaskInstanceSpecFluent.ArgumentsNested editLastArgument(){
            int index = arguments.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last arguments. The list is empty.");
            return setNewArgumentLike(index, buildArgument(index));
    }

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

    public A setToEnvironments(int index,PipelineEnvironment item){
            PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= environments.size()) { environments.add(builder); } else { environments.set(index, builder);}
             return (A)this;
    }

    public A addToEnvironments(PipelineEnvironment... items){
            for (PipelineEnvironment item : items) {PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);_visitables.add(builder);this.environments.add(builder);} return (A)this;
    }

    public A addAllToEnvironments(Collection items){
            for (PipelineEnvironment item : items) {PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);_visitables.add(builder);this.environments.add(builder);} return (A)this;
    }

    public A removeFromEnvironments(PipelineEnvironment... items){
            for (PipelineEnvironment item : items) {PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);_visitables.remove(builder);this.environments.remove(builder);} return (A)this;
    }

    public A removeAllFromEnvironments(Collection items){
            for (PipelineEnvironment item : items) {PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);_visitables.remove(builder);this.environments.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildEnvironments instead.
 */
@Deprecated public List getEnvironments(){
            return build(environments);
    }

    public List buildEnvironments(){
            return build(environments);
    }

    public PipelineEnvironment buildEnvironment(int index){
            return this.environments.get(index).build();
    }

    public PipelineEnvironment buildFirstEnvironment(){
            return this.environments.get(0).build();
    }

    public PipelineEnvironment buildLastEnvironment(){
            return this.environments.get(environments.size() - 1).build();
    }

    public PipelineEnvironment buildMatchingEnvironment(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (PipelineEnvironmentBuilder item: environments) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withEnvironments(List environments){
            _visitables.removeAll(this.environments);
            this.environments.clear();
            if (environments != null) {for (PipelineEnvironment item : environments){this.addToEnvironments(item);}} return (A) this;
    }

    public A withEnvironments(PipelineEnvironment... environments){
            this.environments.clear(); if (environments != null) {for (PipelineEnvironment item :environments){ this.addToEnvironments(item);}} return (A) this;
    }

    public Boolean hasEnvironments(){
            return environments!= null && !environments.isEmpty();
    }

    public PipelineTemplateTaskInstanceSpecFluent.EnvironmentsNested addNewEnvironment(){
            return new EnvironmentsNestedImpl();
    }

    public PipelineTemplateTaskInstanceSpecFluent.EnvironmentsNested addNewEnvironmentLike(PipelineEnvironment item){
            return new EnvironmentsNestedImpl(-1, item);
    }

    public PipelineTemplateTaskInstanceSpecFluent.EnvironmentsNested setNewEnvironmentLike(int index,PipelineEnvironment item){
            return new EnvironmentsNestedImpl(index, item);
    }

    public PipelineTemplateTaskInstanceSpecFluent.EnvironmentsNested editEnvironment(int index){
            if (environments.size() <= index) throw new RuntimeException("Can't edit environments. Index exceeds size.");
            return setNewEnvironmentLike(index, buildEnvironment(index));
    }

    public PipelineTemplateTaskInstanceSpecFluent.EnvironmentsNested editFirstEnvironment(){
            if (environments.size() == 0) throw new RuntimeException("Can't edit first environments. The list is empty.");
            return setNewEnvironmentLike(0, buildEnvironment(0));
    }

    public PipelineTemplateTaskInstanceSpecFluent.EnvironmentsNested editLastEnvironment(){
            int index = environments.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last environments. The list is empty.");
            return setNewEnvironmentLike(index, buildEnvironment(index));
    }

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

    public A setToExports(int index,GlobalParameter item){
            GlobalParameterBuilder builder = new GlobalParameterBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= exports.size()) { exports.add(builder); } else { exports.set(index, builder);}
             return (A)this;
    }

    public A addToExports(GlobalParameter... items){
            for (GlobalParameter item : items) {GlobalParameterBuilder builder = new GlobalParameterBuilder(item);_visitables.add(builder);this.exports.add(builder);} return (A)this;
    }

    public A addAllToExports(Collection items){
            for (GlobalParameter item : items) {GlobalParameterBuilder builder = new GlobalParameterBuilder(item);_visitables.add(builder);this.exports.add(builder);} return (A)this;
    }

    public A removeFromExports(GlobalParameter... items){
            for (GlobalParameter item : items) {GlobalParameterBuilder builder = new GlobalParameterBuilder(item);_visitables.remove(builder);this.exports.remove(builder);} return (A)this;
    }

    public A removeAllFromExports(Collection items){
            for (GlobalParameter item : items) {GlobalParameterBuilder builder = new GlobalParameterBuilder(item);_visitables.remove(builder);this.exports.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildExports instead.
 */
@Deprecated public List getExports(){
            return build(exports);
    }

    public List buildExports(){
            return build(exports);
    }

    public GlobalParameter buildExport(int index){
            return this.exports.get(index).build();
    }

    public GlobalParameter buildFirstExport(){
            return this.exports.get(0).build();
    }

    public GlobalParameter buildLastExport(){
            return this.exports.get(exports.size() - 1).build();
    }

    public GlobalParameter buildMatchingExport(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (GlobalParameterBuilder item: exports) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withExports(List exports){
            _visitables.removeAll(this.exports);
            this.exports.clear();
            if (exports != null) {for (GlobalParameter item : exports){this.addToExports(item);}} return (A) this;
    }

    public A withExports(GlobalParameter... exports){
            this.exports.clear(); if (exports != null) {for (GlobalParameter item :exports){ this.addToExports(item);}} return (A) this;
    }

    public Boolean hasExports(){
            return exports!= null && !exports.isEmpty();
    }

    public PipelineTemplateTaskInstanceSpecFluent.ExportsNested addNewExport(){
            return new ExportsNestedImpl();
    }

    public PipelineTemplateTaskInstanceSpecFluent.ExportsNested addNewExportLike(GlobalParameter item){
            return new ExportsNestedImpl(-1, item);
    }

    public PipelineTemplateTaskInstanceSpecFluent.ExportsNested setNewExportLike(int index,GlobalParameter item){
            return new ExportsNestedImpl(index, item);
    }

    public PipelineTemplateTaskInstanceSpecFluent.ExportsNested editExport(int index){
            if (exports.size() <= index) throw new RuntimeException("Can't edit exports. Index exceeds size.");
            return setNewExportLike(index, buildExport(index));
    }

    public PipelineTemplateTaskInstanceSpecFluent.ExportsNested editFirstExport(){
            if (exports.size() == 0) throw new RuntimeException("Can't edit first exports. The list is empty.");
            return setNewExportLike(0, buildExport(0));
    }

    public PipelineTemplateTaskInstanceSpecFluent.ExportsNested editLastExport(){
            int index = exports.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last exports. The list is empty.");
            return setNewExportLike(index, buildExport(index));
    }

    public PipelineTemplateTaskInstanceSpecFluent.ExportsNested editMatchingExport(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i withNewOptions(){
            return new OptionsNestedImpl();
    }

    public PipelineTemplateTaskInstanceSpecFluent.OptionsNested withNewOptionsLike(PipelineTaskOption item){
            return new OptionsNestedImpl(item);
    }

    public PipelineTemplateTaskInstanceSpecFluent.OptionsNested editOptions(){
            return withNewOptionsLike(getOptions());
    }

    public PipelineTemplateTaskInstanceSpecFluent.OptionsNested editOrNewOptions(){
            return withNewOptionsLike(getOptions() != null ? getOptions(): new PipelineTaskOptionBuilder().build());
    }

    public PipelineTemplateTaskInstanceSpecFluent.OptionsNested editOrNewOptionsLike(PipelineTaskOption item){
            return withNewOptionsLike(getOptions() != null ? getOptions(): item);
    }

    public A withNewOptions(Long timeout){
            return (A)withOptions(new PipelineTaskOption(timeout));
    }

    public String getType(){
            return this.type;
    }

    public A withType(String type){
            this.type=type; return (A) this;
    }

    public Boolean hasType(){
            return this.type!=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;
            PipelineTemplateTaskInstanceSpecFluentImpl that = (PipelineTemplateTaskInstanceSpecFluentImpl) o;
            if (agent != null ? !agent.equals(that.agent) :that.agent != null) return false;
            if (approve != null ? !approve.equals(that.approve) :that.approve != null) return false;
            if (arguments != null ? !arguments.equals(that.arguments) :that.arguments != null) return false;
            if (body != null ? !body.equals(that.body) :that.body != null) return false;
            if (engine != null ? !engine.equals(that.engine) :that.engine != null) return false;
            if (environments != null ? !environments.equals(that.environments) :that.environments != null) return false;
            if (exports != null ? !exports.equals(that.exports) :that.exports != null) return false;
            if (options != null ? !options.equals(that.options) :that.options != null) return false;
            if (type != null ? !type.equals(that.type) :that.type != null) return false;
            return true;
    }


    public class AgentNestedImpl extends JenkinsAgentFluentImpl> implements PipelineTemplateTaskInstanceSpecFluent.AgentNested,io.alauda.kubernetes.api.builder.Nested{

            private final JenkinsAgentBuilder builder;
    
            AgentNestedImpl(JenkinsAgent item){
                    this.builder = new JenkinsAgentBuilder(this, item);
            }
            AgentNestedImpl(){
                    this.builder = new JenkinsAgentBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTemplateTaskInstanceSpecFluentImpl.this.withAgent(builder.build());
    }
    public N endAgent(){
            return and();
    }

}
    public class ApproveNestedImpl extends PipelineTaskApproveFluentImpl> implements PipelineTemplateTaskInstanceSpecFluent.ApproveNested,io.alauda.kubernetes.api.builder.Nested{

            private final PipelineTaskApproveBuilder builder;
    
            ApproveNestedImpl(PipelineTaskApprove item){
                    this.builder = new PipelineTaskApproveBuilder(this, item);
            }
            ApproveNestedImpl(){
                    this.builder = new PipelineTaskApproveBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTemplateTaskInstanceSpecFluentImpl.this.withApprove(builder.build());
    }
    public N endApprove(){
            return and();
    }

}
    public class ArgumentsNestedImpl extends PipelineTemplateArgumentFluentImpl> implements PipelineTemplateTaskInstanceSpecFluent.ArgumentsNested,io.alauda.kubernetes.api.builder.Nested{

            private final PipelineTemplateArgumentBuilder builder;
        private final int index;
    
            ArgumentsNestedImpl(int index,PipelineTemplateArgument item){
                    this.index = index;
                    this.builder = new PipelineTemplateArgumentBuilder(this, item);
            }
            ArgumentsNestedImpl(){
                    this.index = -1;
                    this.builder = new PipelineTemplateArgumentBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTemplateTaskInstanceSpecFluentImpl.this.setToArguments(index, builder.build());
    }
    public N endArgument(){
            return and();
    }

}
    public class EnvironmentsNestedImpl extends PipelineEnvironmentFluentImpl> implements PipelineTemplateTaskInstanceSpecFluent.EnvironmentsNested,io.alauda.kubernetes.api.builder.Nested{

            private final PipelineEnvironmentBuilder builder;
        private final int index;
    
            EnvironmentsNestedImpl(int index,PipelineEnvironment item){
                    this.index = index;
                    this.builder = new PipelineEnvironmentBuilder(this, item);
            }
            EnvironmentsNestedImpl(){
                    this.index = -1;
                    this.builder = new PipelineEnvironmentBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTemplateTaskInstanceSpecFluentImpl.this.setToEnvironments(index, builder.build());
    }
    public N endEnvironment(){
            return and();
    }

}
    public class ExportsNestedImpl extends GlobalParameterFluentImpl> implements PipelineTemplateTaskInstanceSpecFluent.ExportsNested,io.alauda.kubernetes.api.builder.Nested{

            private final GlobalParameterBuilder builder;
        private final int index;
    
            ExportsNestedImpl(int index,GlobalParameter item){
                    this.index = index;
                    this.builder = new GlobalParameterBuilder(this, item);
            }
            ExportsNestedImpl(){
                    this.index = -1;
                    this.builder = new GlobalParameterBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTemplateTaskInstanceSpecFluentImpl.this.setToExports(index, builder.build());
    }
    public N endExport(){
            return and();
    }

}
    public class OptionsNestedImpl extends PipelineTaskOptionFluentImpl> implements PipelineTemplateTaskInstanceSpecFluent.OptionsNested,io.alauda.kubernetes.api.builder.Nested{

            private final PipelineTaskOptionBuilder builder;
    
            OptionsNestedImpl(PipelineTaskOption item){
                    this.builder = new PipelineTaskOptionBuilder(this, item);
            }
            OptionsNestedImpl(){
                    this.builder = new PipelineTaskOptionBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTemplateTaskInstanceSpecFluentImpl.this.withOptions(builder.build());
    }
    public N endOptions(){
            return and();
    }

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy