io.alauda.devops.api.model.BuildStatusFluentImpl Maven / Gradle / Ivy
package io.alauda.devops.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 io.alauda.kubernetes.api.model.ObjectReference;
import java.lang.Deprecated;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import io.alauda.kubernetes.api.model.ObjectReferenceFluentImpl;
import javax.validation.Valid;
import io.alauda.kubernetes.api.model.ObjectReferenceBuilder;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;
public class BuildStatusFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements BuildStatusFluent{
private Boolean cancelled;
private String completionTimestamp;
private ObjectReferenceBuilder config;
private Long duration;
private String logSnippet;
private String message;
private BuildStatusOutputBuilder output;
private String outputDockerImageReference;
private String phase;
private String reason;
private List stages = new ArrayList();
private String startTimestamp;
public BuildStatusFluentImpl(){
}
public BuildStatusFluentImpl(BuildStatus instance){
this.withCancelled(instance.getCancelled());
this.withCompletionTimestamp(instance.getCompletionTimestamp());
this.withConfig(instance.getConfig());
this.withDuration(instance.getDuration());
this.withLogSnippet(instance.getLogSnippet());
this.withMessage(instance.getMessage());
this.withOutput(instance.getOutput());
this.withOutputDockerImageReference(instance.getOutputDockerImageReference());
this.withPhase(instance.getPhase());
this.withReason(instance.getReason());
this.withStages(instance.getStages());
this.withStartTimestamp(instance.getStartTimestamp());
}
public Boolean isCancelled(){
return this.cancelled;
}
public A withCancelled(Boolean cancelled){
this.cancelled=cancelled; return (A) this;
}
public Boolean hasCancelled(){
return this.cancelled!=null;
}
public String getCompletionTimestamp(){
return this.completionTimestamp;
}
public A withCompletionTimestamp(String completionTimestamp){
this.completionTimestamp=completionTimestamp; return (A) this;
}
public Boolean hasCompletionTimestamp(){
return this.completionTimestamp!=null;
}
/**
* This method has been deprecated, please use method buildConfig instead.
*/
@Deprecated public ObjectReference getConfig(){
return this.config!=null?this.config.build():null;
}
public ObjectReference buildConfig(){
return this.config!=null?this.config.build():null;
}
public A withConfig(ObjectReference config){
_visitables.remove(this.config);
if (config!=null){ this.config= new ObjectReferenceBuilder(config); _visitables.add(this.config);} return (A) this;
}
public Boolean hasConfig(){
return this.config!=null;
}
public BuildStatusFluent.ConfigNested withNewConfig(){
return new ConfigNestedImpl();
}
public BuildStatusFluent.ConfigNested withNewConfigLike(ObjectReference item){
return new ConfigNestedImpl(item);
}
public BuildStatusFluent.ConfigNested editConfig(){
return withNewConfigLike(getConfig());
}
public BuildStatusFluent.ConfigNested editOrNewConfig(){
return withNewConfigLike(getConfig() != null ? getConfig(): new ObjectReferenceBuilder().build());
}
public BuildStatusFluent.ConfigNested editOrNewConfigLike(ObjectReference item){
return withNewConfigLike(getConfig() != null ? getConfig(): item);
}
public Long getDuration(){
return this.duration;
}
public A withDuration(Long duration){
this.duration=duration; return (A) this;
}
public Boolean hasDuration(){
return this.duration!=null;
}
public String getLogSnippet(){
return this.logSnippet;
}
public A withLogSnippet(String logSnippet){
this.logSnippet=logSnippet; return (A) this;
}
public Boolean hasLogSnippet(){
return this.logSnippet!=null;
}
public String getMessage(){
return this.message;
}
public A withMessage(String message){
this.message=message; return (A) this;
}
public Boolean hasMessage(){
return this.message!=null;
}
/**
* This method has been deprecated, please use method buildOutput instead.
*/
@Deprecated public BuildStatusOutput getOutput(){
return this.output!=null?this.output.build():null;
}
public BuildStatusOutput buildOutput(){
return this.output!=null?this.output.build():null;
}
public A withOutput(BuildStatusOutput output){
_visitables.remove(this.output);
if (output!=null){ this.output= new BuildStatusOutputBuilder(output); _visitables.add(this.output);} return (A) this;
}
public Boolean hasOutput(){
return this.output!=null;
}
public BuildStatusFluent.OutputNested withNewOutput(){
return new OutputNestedImpl();
}
public BuildStatusFluent.OutputNested withNewOutputLike(BuildStatusOutput item){
return new OutputNestedImpl(item);
}
public BuildStatusFluent.OutputNested editOutput(){
return withNewOutputLike(getOutput());
}
public BuildStatusFluent.OutputNested editOrNewOutput(){
return withNewOutputLike(getOutput() != null ? getOutput(): new BuildStatusOutputBuilder().build());
}
public BuildStatusFluent.OutputNested editOrNewOutputLike(BuildStatusOutput item){
return withNewOutputLike(getOutput() != null ? getOutput(): item);
}
public String getOutputDockerImageReference(){
return this.outputDockerImageReference;
}
public A withOutputDockerImageReference(String outputDockerImageReference){
this.outputDockerImageReference=outputDockerImageReference; return (A) this;
}
public Boolean hasOutputDockerImageReference(){
return this.outputDockerImageReference!=null;
}
public String getPhase(){
return this.phase;
}
public A withPhase(String phase){
this.phase=phase; return (A) this;
}
public Boolean hasPhase(){
return this.phase!=null;
}
public String getReason(){
return this.reason;
}
public A withReason(String reason){
this.reason=reason; return (A) this;
}
public Boolean hasReason(){
return this.reason!=null;
}
public A addToStages(int index,StageInfo item){
StageInfoBuilder builder = new StageInfoBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.stages.add(index >= 0 ? index : stages.size(), builder); return (A)this;
}
public A setToStages(int index,StageInfo item){
StageInfoBuilder builder = new StageInfoBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= stages.size()) { stages.add(builder); } else { stages.set(index, builder);}
return (A)this;
}
public A addToStages(StageInfo... items){
for (StageInfo item : items) {StageInfoBuilder builder = new StageInfoBuilder(item);_visitables.add(builder);this.stages.add(builder);} return (A)this;
}
public A addAllToStages(Collection items){
for (StageInfo item : items) {StageInfoBuilder builder = new StageInfoBuilder(item);_visitables.add(builder);this.stages.add(builder);} return (A)this;
}
public A removeFromStages(StageInfo... items){
for (StageInfo item : items) {StageInfoBuilder builder = new StageInfoBuilder(item);_visitables.remove(builder);this.stages.remove(builder);} return (A)this;
}
public A removeAllFromStages(Collection items){
for (StageInfo item : items) {StageInfoBuilder builder = new StageInfoBuilder(item);_visitables.remove(builder);this.stages.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildStages instead.
*/
@Deprecated public List getStages(){
return build(stages);
}
public List buildStages(){
return build(stages);
}
public StageInfo buildStage(int index){
return this.stages.get(index).build();
}
public StageInfo buildFirstStage(){
return this.stages.get(0).build();
}
public StageInfo buildLastStage(){
return this.stages.get(stages.size() - 1).build();
}
public StageInfo buildMatchingStage(io.alauda.kubernetes.api.builder.Predicate predicate){
for (StageInfoBuilder item: stages) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withStages(List stages){
_visitables.removeAll(this.stages);
this.stages.clear();
if (stages != null) {for (StageInfo item : stages){this.addToStages(item);}} return (A) this;
}
public A withStages(StageInfo... stages){
this.stages.clear(); if (stages != null) {for (StageInfo item :stages){ this.addToStages(item);}} return (A) this;
}
public Boolean hasStages(){
return stages!= null && !stages.isEmpty();
}
public BuildStatusFluent.StagesNested addNewStage(){
return new StagesNestedImpl();
}
public BuildStatusFluent.StagesNested addNewStageLike(StageInfo item){
return new StagesNestedImpl(-1, item);
}
public BuildStatusFluent.StagesNested setNewStageLike(int index,StageInfo item){
return new StagesNestedImpl(index, item);
}
public BuildStatusFluent.StagesNested editStage(int index){
if (stages.size() <= index) throw new RuntimeException("Can't edit stages. Index exceeds size.");
return setNewStageLike(index, buildStage(index));
}
public BuildStatusFluent.StagesNested editFirstStage(){
if (stages.size() == 0) throw new RuntimeException("Can't edit first stages. The list is empty.");
return setNewStageLike(0, buildStage(0));
}
public BuildStatusFluent.StagesNested editLastStage(){
int index = stages.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last stages. The list is empty.");
return setNewStageLike(index, buildStage(index));
}
public BuildStatusFluent.StagesNested editMatchingStage(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends ObjectReferenceFluentImpl> implements BuildStatusFluent.ConfigNested,io.alauda.kubernetes.api.builder.Nested{
private final ObjectReferenceBuilder builder;
ConfigNestedImpl(ObjectReference item){
this.builder = new ObjectReferenceBuilder(this, item);
}
ConfigNestedImpl(){
this.builder = new ObjectReferenceBuilder(this);
}
public N and(){
return (N) BuildStatusFluentImpl.this.withConfig(builder.build());
}
public N endConfig(){
return and();
}
}
public class OutputNestedImpl extends BuildStatusOutputFluentImpl> implements BuildStatusFluent.OutputNested,io.alauda.kubernetes.api.builder.Nested{
private final BuildStatusOutputBuilder builder;
OutputNestedImpl(BuildStatusOutput item){
this.builder = new BuildStatusOutputBuilder(this, item);
}
OutputNestedImpl(){
this.builder = new BuildStatusOutputBuilder(this);
}
public N and(){
return (N) BuildStatusFluentImpl.this.withOutput(builder.build());
}
public N endOutput(){
return and();
}
}
public class StagesNestedImpl extends StageInfoFluentImpl> implements BuildStatusFluent.StagesNested,io.alauda.kubernetes.api.builder.Nested{
private final StageInfoBuilder builder;
private final int index;
StagesNestedImpl(int index,StageInfo item){
this.index = index;
this.builder = new StageInfoBuilder(this, item);
}
StagesNestedImpl(){
this.index = -1;
this.builder = new StageInfoBuilder(this);
}
public N and(){
return (N) BuildStatusFluentImpl.this.setToStages(index, builder.build());
}
public N endStage(){
return and();
}
}
}