io.fabric8.knative.flows.v1.SequenceSpecFluent Maven / Gradle / Ivy
The newest version!
package io.fabric8.knative.flows.v1;
import io.fabric8.knative.duck.v1.Destination;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import io.fabric8.knative.messaging.v1.ChannelTemplateSpec;
import java.lang.String;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import io.fabric8.knative.duck.v1.DestinationFluent;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder;
import io.fabric8.knative.messaging.v1.ChannelTemplateSpecFluent;
import io.fabric8.knative.duck.v1.DestinationBuilder;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class SequenceSpecFluent> extends BaseFluent{
public SequenceSpecFluent() {
}
public SequenceSpecFluent(SequenceSpec instance) {
this.copyInstance(instance);
}
private ChannelTemplateSpecBuilder channelTemplate;
private DestinationBuilder reply;
private ArrayList steps = new ArrayList();
private Map additionalProperties;
protected void copyInstance(SequenceSpec instance) {
instance = (instance != null ? instance : new SequenceSpec());
if (instance != null) {
this.withChannelTemplate(instance.getChannelTemplate());
this.withReply(instance.getReply());
this.withSteps(instance.getSteps());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public ChannelTemplateSpec buildChannelTemplate() {
return this.channelTemplate != null ? this.channelTemplate.build() : null;
}
public A withChannelTemplate(ChannelTemplateSpec channelTemplate) {
this._visitables.remove("channelTemplate");
if (channelTemplate != null) {
this.channelTemplate = new ChannelTemplateSpecBuilder(channelTemplate);
this._visitables.get("channelTemplate").add(this.channelTemplate);
} else {
this.channelTemplate = null;
this._visitables.get("channelTemplate").remove(this.channelTemplate);
}
return (A) this;
}
public boolean hasChannelTemplate() {
return this.channelTemplate != null;
}
public A withNewChannelTemplate(String apiVersion,String kind,Object spec) {
return (A)withChannelTemplate(new ChannelTemplateSpec(apiVersion, kind, spec));
}
public ChannelTemplateNested withNewChannelTemplate() {
return new ChannelTemplateNested(null);
}
public ChannelTemplateNested withNewChannelTemplateLike(ChannelTemplateSpec item) {
return new ChannelTemplateNested(item);
}
public ChannelTemplateNested editChannelTemplate() {
return withNewChannelTemplateLike(java.util.Optional.ofNullable(buildChannelTemplate()).orElse(null));
}
public ChannelTemplateNested editOrNewChannelTemplate() {
return withNewChannelTemplateLike(java.util.Optional.ofNullable(buildChannelTemplate()).orElse(new ChannelTemplateSpecBuilder().build()));
}
public ChannelTemplateNested editOrNewChannelTemplateLike(ChannelTemplateSpec item) {
return withNewChannelTemplateLike(java.util.Optional.ofNullable(buildChannelTemplate()).orElse(item));
}
public Destination buildReply() {
return this.reply != null ? this.reply.build() : null;
}
public A withReply(Destination reply) {
this._visitables.remove("reply");
if (reply != null) {
this.reply = new DestinationBuilder(reply);
this._visitables.get("reply").add(this.reply);
} else {
this.reply = null;
this._visitables.get("reply").remove(this.reply);
}
return (A) this;
}
public boolean hasReply() {
return this.reply != null;
}
public ReplyNested withNewReply() {
return new ReplyNested(null);
}
public ReplyNested withNewReplyLike(Destination item) {
return new ReplyNested(item);
}
public ReplyNested editReply() {
return withNewReplyLike(java.util.Optional.ofNullable(buildReply()).orElse(null));
}
public ReplyNested editOrNewReply() {
return withNewReplyLike(java.util.Optional.ofNullable(buildReply()).orElse(new DestinationBuilder().build()));
}
public ReplyNested editOrNewReplyLike(Destination item) {
return withNewReplyLike(java.util.Optional.ofNullable(buildReply()).orElse(item));
}
public A addToSteps(int index,SequenceStep item) {
if (this.steps == null) {this.steps = new ArrayList();}
SequenceStepBuilder builder = new SequenceStepBuilder(item);
if (index < 0 || index >= steps.size()) { _visitables.get("steps").add(builder); steps.add(builder); } else { _visitables.get("steps").add(index, builder); steps.add(index, builder);}
return (A)this;
}
public A setToSteps(int index,SequenceStep item) {
if (this.steps == null) {this.steps = new ArrayList();}
SequenceStepBuilder builder = new SequenceStepBuilder(item);
if (index < 0 || index >= steps.size()) { _visitables.get("steps").add(builder); steps.add(builder); } else { _visitables.get("steps").set(index, builder); steps.set(index, builder);}
return (A)this;
}
public A addToSteps(io.fabric8.knative.flows.v1.SequenceStep... items) {
if (this.steps == null) {this.steps = new ArrayList();}
for (SequenceStep item : items) {SequenceStepBuilder builder = new SequenceStepBuilder(item);_visitables.get("steps").add(builder);this.steps.add(builder);} return (A)this;
}
public A addAllToSteps(Collection items) {
if (this.steps == null) {this.steps = new ArrayList();}
for (SequenceStep item : items) {SequenceStepBuilder builder = new SequenceStepBuilder(item);_visitables.get("steps").add(builder);this.steps.add(builder);} return (A)this;
}
public A removeFromSteps(io.fabric8.knative.flows.v1.SequenceStep... items) {
if (this.steps == null) return (A)this;
for (SequenceStep item : items) {SequenceStepBuilder builder = new SequenceStepBuilder(item);_visitables.get("steps").remove(builder); this.steps.remove(builder);} return (A)this;
}
public A removeAllFromSteps(Collection items) {
if (this.steps == null) return (A)this;
for (SequenceStep item : items) {SequenceStepBuilder builder = new SequenceStepBuilder(item);_visitables.get("steps").remove(builder); this.steps.remove(builder);} return (A)this;
}
public A removeMatchingFromSteps(Predicate predicate) {
if (steps == null) return (A) this;
final Iterator each = steps.iterator();
final List visitables = _visitables.get("steps");
while (each.hasNext()) {
SequenceStepBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildSteps() {
return this.steps != null ? build(steps) : null;
}
public SequenceStep buildStep(int index) {
return this.steps.get(index).build();
}
public SequenceStep buildFirstStep() {
return this.steps.get(0).build();
}
public SequenceStep buildLastStep() {
return this.steps.get(steps.size() - 1).build();
}
public SequenceStep buildMatchingStep(Predicate predicate) {
for (SequenceStepBuilder item : steps) {
if (predicate.test(item)) {
return item.build();
}
}
return null;
}
public boolean hasMatchingStep(Predicate predicate) {
for (SequenceStepBuilder item : steps) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withSteps(List steps) {
if (this.steps != null) {
this._visitables.get("steps").clear();
}
if (steps != null) {
this.steps = new ArrayList();
for (SequenceStep item : steps) {
this.addToSteps(item);
}
} else {
this.steps = null;
}
return (A) this;
}
public A withSteps(io.fabric8.knative.flows.v1.SequenceStep... steps) {
if (this.steps != null) {
this.steps.clear();
_visitables.remove("steps");
}
if (steps != null) {
for (SequenceStep item : steps) {
this.addToSteps(item);
}
}
return (A) this;
}
public boolean hasSteps() {
return this.steps != null && !this.steps.isEmpty();
}
public StepsNested addNewStep() {
return new StepsNested(-1, null);
}
public StepsNested addNewStepLike(SequenceStep item) {
return new StepsNested(-1, item);
}
public StepsNested setNewStepLike(int index,SequenceStep item) {
return new StepsNested(index, item);
}
public StepsNested editStep(int index) {
if (steps.size() <= index) throw new RuntimeException("Can't edit steps. Index exceeds size.");
return setNewStepLike(index, buildStep(index));
}
public StepsNested editFirstStep() {
if (steps.size() == 0) throw new RuntimeException("Can't edit first steps. The list is empty.");
return setNewStepLike(0, buildStep(0));
}
public StepsNested editLastStep() {
int index = steps.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last steps. The list is empty.");
return setNewStepLike(index, buildStep(index));
}
public StepsNested editMatchingStep(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;
SequenceSpecFluent that = (SequenceSpecFluent) o;
if (!java.util.Objects.equals(channelTemplate, that.channelTemplate)) return false;
if (!java.util.Objects.equals(reply, that.reply)) return false;
if (!java.util.Objects.equals(steps, that.steps)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(channelTemplate, reply, steps, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (channelTemplate != null) { sb.append("channelTemplate:"); sb.append(channelTemplate + ","); }
if (reply != null) { sb.append("reply:"); sb.append(reply + ","); }
if (steps != null && !steps.isEmpty()) { sb.append("steps:"); sb.append(steps + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class ChannelTemplateNested extends ChannelTemplateSpecFluent> implements Nested{
ChannelTemplateNested(ChannelTemplateSpec item) {
this.builder = new ChannelTemplateSpecBuilder(this, item);
}
ChannelTemplateSpecBuilder builder;
public N and() {
return (N) SequenceSpecFluent.this.withChannelTemplate(builder.build());
}
public N endChannelTemplate() {
return and();
}
}
public class ReplyNested extends DestinationFluent> implements Nested{
ReplyNested(Destination item) {
this.builder = new DestinationBuilder(this, item);
}
DestinationBuilder builder;
public N and() {
return (N) SequenceSpecFluent.this.withReply(builder.build());
}
public N endReply() {
return and();
}
}
public class StepsNested extends SequenceStepFluent> implements Nested{
StepsNested(int index,SequenceStep item) {
this.index = index;
this.builder = new SequenceStepBuilder(this, item);
}
SequenceStepBuilder builder;
int index;
public N and() {
return (N) SequenceSpecFluent.this.setToSteps(index,builder.build());
}
public N endStep() {
return and();
}
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy