io.fabric8.openshift.api.model.BuildStatusFluent Maven / Gradle / Ivy
package io.fabric8.openshift.api.model;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import io.fabric8.kubernetes.api.model.ObjectReference;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import io.fabric8.kubernetes.api.model.ObjectReferenceFluent;
import io.fabric8.kubernetes.api.model.ObjectReferenceBuilder;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class BuildStatusFluent> extends BaseFluent{
public BuildStatusFluent() {
}
public BuildStatusFluent(BuildStatus instance) {
this.copyInstance(instance);
}
private Boolean cancelled;
private String completionTimestamp;
private ArrayList conditions = new ArrayList();
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 ArrayList stages = new ArrayList();
private String startTimestamp;
private Map additionalProperties;
protected void copyInstance(BuildStatus instance) {
instance = (instance != null ? instance : new BuildStatus());
if (instance != null) {
this.withCancelled(instance.getCancelled());
this.withCompletionTimestamp(instance.getCompletionTimestamp());
this.withConditions(instance.getConditions());
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());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public Boolean getCancelled() {
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;
}
public A addToConditions(int index,BuildCondition item) {
if (this.conditions == null) {this.conditions = new ArrayList();}
BuildConditionBuilder builder = new BuildConditionBuilder(item);
if (index < 0 || index >= conditions.size()) { _visitables.get("conditions").add(builder); conditions.add(builder); } else { _visitables.get("conditions").add(index, builder); conditions.add(index, builder);}
return (A)this;
}
public A setToConditions(int index,BuildCondition item) {
if (this.conditions == null) {this.conditions = new ArrayList();}
BuildConditionBuilder builder = new BuildConditionBuilder(item);
if (index < 0 || index >= conditions.size()) { _visitables.get("conditions").add(builder); conditions.add(builder); } else { _visitables.get("conditions").set(index, builder); conditions.set(index, builder);}
return (A)this;
}
public A addToConditions(io.fabric8.openshift.api.model.BuildCondition... items) {
if (this.conditions == null) {this.conditions = new ArrayList();}
for (BuildCondition item : items) {BuildConditionBuilder builder = new BuildConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
}
public A addAllToConditions(Collection items) {
if (this.conditions == null) {this.conditions = new ArrayList();}
for (BuildCondition item : items) {BuildConditionBuilder builder = new BuildConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
}
public A removeFromConditions(io.fabric8.openshift.api.model.BuildCondition... items) {
if (this.conditions == null) return (A)this;
for (BuildCondition item : items) {BuildConditionBuilder builder = new BuildConditionBuilder(item);_visitables.get("conditions").remove(builder); this.conditions.remove(builder);} return (A)this;
}
public A removeAllFromConditions(Collection items) {
if (this.conditions == null) return (A)this;
for (BuildCondition item : items) {BuildConditionBuilder builder = new BuildConditionBuilder(item);_visitables.get("conditions").remove(builder); this.conditions.remove(builder);} return (A)this;
}
public A removeMatchingFromConditions(Predicate predicate) {
if (conditions == null) return (A) this;
final Iterator each = conditions.iterator();
final List visitables = _visitables.get("conditions");
while (each.hasNext()) {
BuildConditionBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildConditions() {
return this.conditions != null ? build(conditions) : null;
}
public BuildCondition buildCondition(int index) {
return this.conditions.get(index).build();
}
public BuildCondition buildFirstCondition() {
return this.conditions.get(0).build();
}
public BuildCondition buildLastCondition() {
return this.conditions.get(conditions.size() - 1).build();
}
public BuildCondition buildMatchingCondition(Predicate predicate) {
for (BuildConditionBuilder item : conditions) {
if (predicate.test(item)) {
return item.build();
}
}
return null;
}
public boolean hasMatchingCondition(Predicate predicate) {
for (BuildConditionBuilder item : conditions) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withConditions(List conditions) {
if (this.conditions != null) {
this._visitables.get("conditions").clear();
}
if (conditions != null) {
this.conditions = new ArrayList();
for (BuildCondition item : conditions) {
this.addToConditions(item);
}
} else {
this.conditions = null;
}
return (A) this;
}
public A withConditions(io.fabric8.openshift.api.model.BuildCondition... conditions) {
if (this.conditions != null) {
this.conditions.clear();
_visitables.remove("conditions");
}
if (conditions != null) {
for (BuildCondition item : conditions) {
this.addToConditions(item);
}
}
return (A) this;
}
public boolean hasConditions() {
return this.conditions != null && !this.conditions.isEmpty();
}
public ConditionsNested addNewCondition() {
return new ConditionsNested(-1, null);
}
public ConditionsNested addNewConditionLike(BuildCondition item) {
return new ConditionsNested(-1, item);
}
public ConditionsNested setNewConditionLike(int index,BuildCondition item) {
return new ConditionsNested(index, item);
}
public ConditionsNested editCondition(int index) {
if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
return setNewConditionLike(index, buildCondition(index));
}
public ConditionsNested editFirstCondition() {
if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
return setNewConditionLike(0, buildCondition(0));
}
public 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 ConditionsNested editMatchingCondition(Predicate predicate) {
int index = -1;
for (int i=0;i withNewConfig() {
return new ConfigNested(null);
}
public ConfigNested withNewConfigLike(ObjectReference item) {
return new ConfigNested(item);
}
public ConfigNested editConfig() {
return withNewConfigLike(java.util.Optional.ofNullable(buildConfig()).orElse(null));
}
public ConfigNested editOrNewConfig() {
return withNewConfigLike(java.util.Optional.ofNullable(buildConfig()).orElse(new ObjectReferenceBuilder().build()));
}
public ConfigNested editOrNewConfigLike(ObjectReference item) {
return withNewConfigLike(java.util.Optional.ofNullable(buildConfig()).orElse(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;
}
public BuildStatusOutput buildOutput() {
return this.output != null ? this.output.build() : null;
}
public A withOutput(BuildStatusOutput output) {
this._visitables.remove("output");
if (output != null) {
this.output = new BuildStatusOutputBuilder(output);
this._visitables.get("output").add(this.output);
} else {
this.output = null;
this._visitables.get("output").remove(this.output);
}
return (A) this;
}
public boolean hasOutput() {
return this.output != null;
}
public OutputNested withNewOutput() {
return new OutputNested(null);
}
public OutputNested withNewOutputLike(BuildStatusOutput item) {
return new OutputNested(item);
}
public OutputNested editOutput() {
return withNewOutputLike(java.util.Optional.ofNullable(buildOutput()).orElse(null));
}
public OutputNested editOrNewOutput() {
return withNewOutputLike(java.util.Optional.ofNullable(buildOutput()).orElse(new BuildStatusOutputBuilder().build()));
}
public OutputNested editOrNewOutputLike(BuildStatusOutput item) {
return withNewOutputLike(java.util.Optional.ofNullable(buildOutput()).orElse(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) {
if (this.stages == null) {this.stages = new ArrayList();}
StageInfoBuilder builder = new StageInfoBuilder(item);
if (index < 0 || index >= stages.size()) { _visitables.get("stages").add(builder); stages.add(builder); } else { _visitables.get("stages").add(index, builder); stages.add(index, builder);}
return (A)this;
}
public A setToStages(int index,StageInfo item) {
if (this.stages == null) {this.stages = new ArrayList();}
StageInfoBuilder builder = new StageInfoBuilder(item);
if (index < 0 || index >= stages.size()) { _visitables.get("stages").add(builder); stages.add(builder); } else { _visitables.get("stages").set(index, builder); stages.set(index, builder);}
return (A)this;
}
public A addToStages(io.fabric8.openshift.api.model.StageInfo... items) {
if (this.stages == null) {this.stages = new ArrayList();}
for (StageInfo item : items) {StageInfoBuilder builder = new StageInfoBuilder(item);_visitables.get("stages").add(builder);this.stages.add(builder);} return (A)this;
}
public A addAllToStages(Collection items) {
if (this.stages == null) {this.stages = new ArrayList();}
for (StageInfo item : items) {StageInfoBuilder builder = new StageInfoBuilder(item);_visitables.get("stages").add(builder);this.stages.add(builder);} return (A)this;
}
public A removeFromStages(io.fabric8.openshift.api.model.StageInfo... items) {
if (this.stages == null) return (A)this;
for (StageInfo item : items) {StageInfoBuilder builder = new StageInfoBuilder(item);_visitables.get("stages").remove(builder); this.stages.remove(builder);} return (A)this;
}
public A removeAllFromStages(Collection items) {
if (this.stages == null) return (A)this;
for (StageInfo item : items) {StageInfoBuilder builder = new StageInfoBuilder(item);_visitables.get("stages").remove(builder); this.stages.remove(builder);} return (A)this;
}
public A removeMatchingFromStages(Predicate predicate) {
if (stages == null) return (A) this;
final Iterator each = stages.iterator();
final List visitables = _visitables.get("stages");
while (each.hasNext()) {
StageInfoBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildStages() {
return this.stages != null ? build(stages) : null;
}
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(Predicate predicate) {
for (StageInfoBuilder item : stages) {
if (predicate.test(item)) {
return item.build();
}
}
return null;
}
public boolean hasMatchingStage(Predicate predicate) {
for (StageInfoBuilder item : stages) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withStages(List stages) {
if (this.stages != null) {
this._visitables.get("stages").clear();
}
if (stages != null) {
this.stages = new ArrayList();
for (StageInfo item : stages) {
this.addToStages(item);
}
} else {
this.stages = null;
}
return (A) this;
}
public A withStages(io.fabric8.openshift.api.model.StageInfo... stages) {
if (this.stages != null) {
this.stages.clear();
_visitables.remove("stages");
}
if (stages != null) {
for (StageInfo item : stages) {
this.addToStages(item);
}
}
return (A) this;
}
public boolean hasStages() {
return this.stages != null && !this.stages.isEmpty();
}
public StagesNested addNewStage() {
return new StagesNested(-1, null);
}
public StagesNested addNewStageLike(StageInfo item) {
return new StagesNested(-1, item);
}
public StagesNested setNewStageLike(int index,StageInfo item) {
return new StagesNested(index, item);
}
public StagesNested editStage(int index) {
if (stages.size() <= index) throw new RuntimeException("Can't edit stages. Index exceeds size.");
return setNewStageLike(index, buildStage(index));
}
public StagesNested editFirstStage() {
if (stages.size() == 0) throw new RuntimeException("Can't edit first stages. The list is empty.");
return setNewStageLike(0, buildStage(0));
}
public 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 StagesNested editMatchingStage(Predicate predicate) {
int index = -1;
for (int i=0;i map) {
if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
}
public A removeFromAdditionalProperties(String key) {
if(this.additionalProperties == null) { return (A) this; }
if(key != null && this.additionalProperties != null) {this.additionalProperties.remove(key);} return (A)this;
}
public A removeFromAdditionalProperties(Map map) {
if(this.additionalProperties == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.additionalProperties != null){this.additionalProperties.remove(key);}}} return (A)this;
}
public Map getAdditionalProperties() {
return this.additionalProperties;
}
public A withAdditionalProperties(Map additionalProperties) {
if (additionalProperties == null) {
this.additionalProperties = null;
} else {
this.additionalProperties = new LinkedHashMap(additionalProperties);
}
return (A) this;
}
public boolean hasAdditionalProperties() {
return this.additionalProperties != 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;
BuildStatusFluent that = (BuildStatusFluent) o;
if (!java.util.Objects.equals(cancelled, that.cancelled)) return false;
if (!java.util.Objects.equals(completionTimestamp, that.completionTimestamp)) return false;
if (!java.util.Objects.equals(conditions, that.conditions)) return false;
if (!java.util.Objects.equals(config, that.config)) return false;
if (!java.util.Objects.equals(duration, that.duration)) return false;
if (!java.util.Objects.equals(logSnippet, that.logSnippet)) return false;
if (!java.util.Objects.equals(message, that.message)) return false;
if (!java.util.Objects.equals(output, that.output)) return false;
if (!java.util.Objects.equals(outputDockerImageReference, that.outputDockerImageReference)) return false;
if (!java.util.Objects.equals(phase, that.phase)) return false;
if (!java.util.Objects.equals(reason, that.reason)) return false;
if (!java.util.Objects.equals(stages, that.stages)) return false;
if (!java.util.Objects.equals(startTimestamp, that.startTimestamp)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(cancelled, completionTimestamp, conditions, config, duration, logSnippet, message, output, outputDockerImageReference, phase, reason, stages, startTimestamp, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (cancelled != null) { sb.append("cancelled:"); sb.append(cancelled + ","); }
if (completionTimestamp != null) { sb.append("completionTimestamp:"); sb.append(completionTimestamp + ","); }
if (conditions != null && !conditions.isEmpty()) { sb.append("conditions:"); sb.append(conditions + ","); }
if (config != null) { sb.append("config:"); sb.append(config + ","); }
if (duration != null) { sb.append("duration:"); sb.append(duration + ","); }
if (logSnippet != null) { sb.append("logSnippet:"); sb.append(logSnippet + ","); }
if (message != null) { sb.append("message:"); sb.append(message + ","); }
if (output != null) { sb.append("output:"); sb.append(output + ","); }
if (outputDockerImageReference != null) { sb.append("outputDockerImageReference:"); sb.append(outputDockerImageReference + ","); }
if (phase != null) { sb.append("phase:"); sb.append(phase + ","); }
if (reason != null) { sb.append("reason:"); sb.append(reason + ","); }
if (stages != null && !stages.isEmpty()) { sb.append("stages:"); sb.append(stages + ","); }
if (startTimestamp != null) { sb.append("startTimestamp:"); sb.append(startTimestamp + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public A withCancelled() {
return withCancelled(true);
}
public class ConditionsNested extends BuildConditionFluent> implements Nested{
ConditionsNested(int index,BuildCondition item) {
this.index = index;
this.builder = new BuildConditionBuilder(this, item);
}
BuildConditionBuilder builder;
int index;
public N and() {
return (N) BuildStatusFluent.this.setToConditions(index,builder.build());
}
public N endCondition() {
return and();
}
}
public class ConfigNested extends ObjectReferenceFluent> implements Nested{
ConfigNested(ObjectReference item) {
this.builder = new ObjectReferenceBuilder(this, item);
}
ObjectReferenceBuilder builder;
public N and() {
return (N) BuildStatusFluent.this.withConfig(builder.build());
}
public N endConfig() {
return and();
}
}
public class OutputNested extends BuildStatusOutputFluent> implements Nested{
OutputNested(BuildStatusOutput item) {
this.builder = new BuildStatusOutputBuilder(this, item);
}
BuildStatusOutputBuilder builder;
public N and() {
return (N) BuildStatusFluent.this.withOutput(builder.build());
}
public N endOutput() {
return and();
}
}
public class StagesNested extends StageInfoFluent> implements Nested{
StagesNested(int index,StageInfo item) {
this.index = index;
this.builder = new StageInfoBuilder(this, item);
}
StageInfoBuilder builder;
int index;
public N and() {
return (N) BuildStatusFluent.this.setToStages(index,builder.build());
}
public N endStage() {
return and();
}
}
}