annotations.io.fabric8.knative.flows.v1.ParallelSpecFluentImpl Maven / Gradle / Ivy
package io.fabric8.knative.flows.v1;
import io.fabric8.knative.internal.pkg.apis.duck.v1.Destination;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import io.fabric8.knative.messaging.v1.ChannelTemplateSpec;
import java.util.function.Predicate;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder;
import java.lang.Integer;
import io.fabric8.knative.messaging.v1.ChannelTemplateSpecFluentImpl;
import io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder;
import java.util.Collection;
import java.lang.Object;
import io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationFluentImpl;
/**
* Generated
*/
public class ParallelSpecFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements io.fabric8.knative.flows.v1.ParallelSpecFluent{
public ParallelSpecFluentImpl() {
}
public ParallelSpecFluentImpl(io.fabric8.knative.flows.v1.ParallelSpec instance) {
this.withBranches(instance.getBranches());
this.withChannelTemplate(instance.getChannelTemplate());
this.withReply(instance.getReply());
}
private java.util.List branches;
private io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder channelTemplate;
private io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder reply;
public A addToBranches(java.lang.Integer index,io.fabric8.knative.flows.v1.ParallelBranch item) {
if (this.branches == null) {this.branches = new java.util.ArrayList();}
io.fabric8.knative.flows.v1.ParallelBranchBuilder builder = new io.fabric8.knative.flows.v1.ParallelBranchBuilder(item);_visitables.get("branches").add(index >= 0 ? index : _visitables.get("branches").size(), builder);this.branches.add(index >= 0 ? index : branches.size(), builder); return (A)this;
}
public A setToBranches(java.lang.Integer index,io.fabric8.knative.flows.v1.ParallelBranch item) {
if (this.branches == null) {this.branches = new java.util.ArrayList();}
io.fabric8.knative.flows.v1.ParallelBranchBuilder builder = new io.fabric8.knative.flows.v1.ParallelBranchBuilder(item);
if (index < 0 || index >= _visitables.get("branches").size()) { _visitables.get("branches").add(builder); } else { _visitables.get("branches").set(index, builder);}
if (index < 0 || index >= branches.size()) { branches.add(builder); } else { branches.set(index, builder);}
return (A)this;
}
public A addToBranches(io.fabric8.knative.flows.v1.ParallelBranch... items) {
if (this.branches == null) {this.branches = new java.util.ArrayList();}
for (io.fabric8.knative.flows.v1.ParallelBranch item : items) {io.fabric8.knative.flows.v1.ParallelBranchBuilder builder = new io.fabric8.knative.flows.v1.ParallelBranchBuilder(item);_visitables.get("branches").add(builder);this.branches.add(builder);} return (A)this;
}
public A addAllToBranches(java.util.Collection items) {
if (this.branches == null) {this.branches = new java.util.ArrayList();}
for (io.fabric8.knative.flows.v1.ParallelBranch item : items) {io.fabric8.knative.flows.v1.ParallelBranchBuilder builder = new io.fabric8.knative.flows.v1.ParallelBranchBuilder(item);_visitables.get("branches").add(builder);this.branches.add(builder);} return (A)this;
}
public A removeFromBranches(io.fabric8.knative.flows.v1.ParallelBranch... items) {
for (io.fabric8.knative.flows.v1.ParallelBranch item : items) {io.fabric8.knative.flows.v1.ParallelBranchBuilder builder = new io.fabric8.knative.flows.v1.ParallelBranchBuilder(item);_visitables.get("branches").remove(builder);if (this.branches != null) {this.branches.remove(builder);}} return (A)this;
}
public A removeAllFromBranches(java.util.Collection items) {
for (io.fabric8.knative.flows.v1.ParallelBranch item : items) {io.fabric8.knative.flows.v1.ParallelBranchBuilder builder = new io.fabric8.knative.flows.v1.ParallelBranchBuilder(item);_visitables.get("branches").remove(builder);if (this.branches != null) {this.branches.remove(builder);}} return (A)this;
}
public A removeMatchingFromBranches(java.util.function.Predicate predicate) {
if (branches == null) return (A) this;
final Iterator each = branches.iterator();
final List visitables = _visitables.get("branches");
while (each.hasNext()) {
io.fabric8.knative.flows.v1.ParallelBranchBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildBranches instead.
* @return The buildable object.
*/
@java.lang.Deprecated
public java.util.List getBranches() {
return build(branches);
}
public java.util.List buildBranches() {
return build(branches);
}
public io.fabric8.knative.flows.v1.ParallelBranch buildBranch(java.lang.Integer index) {
return this.branches.get(index).build();
}
public io.fabric8.knative.flows.v1.ParallelBranch buildFirstBranch() {
return this.branches.get(0).build();
}
public io.fabric8.knative.flows.v1.ParallelBranch buildLastBranch() {
return this.branches.get(branches.size() - 1).build();
}
public io.fabric8.knative.flows.v1.ParallelBranch buildMatchingBranch(java.util.function.Predicate predicate) {
for (io.fabric8.knative.flows.v1.ParallelBranchBuilder item: branches) { if(predicate.test(item)){ return item.build();} } return null;
}
public java.lang.Boolean hasMatchingBranch(java.util.function.Predicate predicate) {
for (io.fabric8.knative.flows.v1.ParallelBranchBuilder item: branches) { if(predicate.test(item)){ return true;} } return false;
}
public A withBranches(java.util.List branches) {
if (this.branches != null) { _visitables.get("branches").removeAll(this.branches);}
if (branches != null) {this.branches = new java.util.ArrayList(); for (io.fabric8.knative.flows.v1.ParallelBranch item : branches){this.addToBranches(item);}} else { this.branches = null;} return (A) this;
}
public A withBranches(io.fabric8.knative.flows.v1.ParallelBranch... branches) {
if (this.branches != null) {this.branches.clear();}
if (branches != null) {for (io.fabric8.knative.flows.v1.ParallelBranch item :branches){ this.addToBranches(item);}} return (A) this;
}
public java.lang.Boolean hasBranches() {
return branches != null && !branches.isEmpty();
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.BranchesNested addNewBranch() {
return new io.fabric8.knative.flows.v1.ParallelSpecFluentImpl.BranchesNestedImpl();
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.BranchesNested addNewBranchLike(io.fabric8.knative.flows.v1.ParallelBranch item) {
return new io.fabric8.knative.flows.v1.ParallelSpecFluentImpl.BranchesNestedImpl(-1, item);
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.BranchesNested setNewBranchLike(java.lang.Integer index,io.fabric8.knative.flows.v1.ParallelBranch item) {
return new io.fabric8.knative.flows.v1.ParallelSpecFluentImpl.BranchesNestedImpl(index, item);
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.BranchesNested editBranch(java.lang.Integer index) {
if (branches.size() <= index) throw new RuntimeException("Can't edit branches. Index exceeds size.");
return setNewBranchLike(index, buildBranch(index));
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.BranchesNested editFirstBranch() {
if (branches.size() == 0) throw new RuntimeException("Can't edit first branches. The list is empty.");
return setNewBranchLike(0, buildBranch(0));
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.BranchesNested editLastBranch() {
int index = branches.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last branches. The list is empty.");
return setNewBranchLike(index, buildBranch(index));
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.BranchesNested editMatchingBranch(java.util.function.Predicate predicate) {
int index = -1;
for (int i=0;i withNewChannelTemplate() {
return new io.fabric8.knative.flows.v1.ParallelSpecFluentImpl.ChannelTemplateNestedImpl();
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.ChannelTemplateNested withNewChannelTemplateLike(io.fabric8.knative.messaging.v1.ChannelTemplateSpec item) {
return new io.fabric8.knative.flows.v1.ParallelSpecFluentImpl.ChannelTemplateNestedImpl(item);
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.ChannelTemplateNested editChannelTemplate() {
return withNewChannelTemplateLike(getChannelTemplate());
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.ChannelTemplateNested editOrNewChannelTemplate() {
return withNewChannelTemplateLike(getChannelTemplate() != null ? getChannelTemplate(): new io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder().build());
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.ChannelTemplateNested editOrNewChannelTemplateLike(io.fabric8.knative.messaging.v1.ChannelTemplateSpec item) {
return withNewChannelTemplateLike(getChannelTemplate() != null ? getChannelTemplate(): item);
}
/**
* This method has been deprecated, please use method buildReply instead.
* @return The buildable object.
*/
@java.lang.Deprecated
public io.fabric8.knative.internal.pkg.apis.duck.v1.Destination getReply() {
return this.reply!=null?this.reply.build():null;
}
public io.fabric8.knative.internal.pkg.apis.duck.v1.Destination buildReply() {
return this.reply!=null?this.reply.build():null;
}
public A withReply(io.fabric8.knative.internal.pkg.apis.duck.v1.Destination reply) {
_visitables.get("reply").remove(this.reply);
if (reply!=null){ this.reply= new io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder(reply); _visitables.get("reply").add(this.reply);} return (A) this;
}
public java.lang.Boolean hasReply() {
return this.reply != null;
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.ReplyNested withNewReply() {
return new io.fabric8.knative.flows.v1.ParallelSpecFluentImpl.ReplyNestedImpl();
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.ReplyNested withNewReplyLike(io.fabric8.knative.internal.pkg.apis.duck.v1.Destination item) {
return new io.fabric8.knative.flows.v1.ParallelSpecFluentImpl.ReplyNestedImpl(item);
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.ReplyNested editReply() {
return withNewReplyLike(getReply());
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.ReplyNested editOrNewReply() {
return withNewReplyLike(getReply() != null ? getReply(): new io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder().build());
}
public io.fabric8.knative.flows.v1.ParallelSpecFluent.ReplyNested editOrNewReplyLike(io.fabric8.knative.internal.pkg.apis.duck.v1.Destination item) {
return withNewReplyLike(getReply() != null ? getReply(): item);
}
public boolean equals(java.lang.Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ParallelSpecFluentImpl that = (ParallelSpecFluentImpl) o;
if (branches != null ? !branches.equals(that.branches) :that.branches != null) return false;
if (channelTemplate != null ? !channelTemplate.equals(that.channelTemplate) :that.channelTemplate != null) return false;
if (reply != null ? !reply.equals(that.reply) :that.reply != null) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(branches, channelTemplate, reply, super.hashCode());
}
public class BranchesNestedImpl extends io.fabric8.knative.flows.v1.ParallelBranchFluentImpl> implements io.fabric8.knative.flows.v1.ParallelSpecFluent.BranchesNested,io.fabric8.kubernetes.api.builder.Nested{
BranchesNestedImpl(java.lang.Integer index,io.fabric8.knative.flows.v1.ParallelBranch item) {
this.index = index;
this.builder = new io.fabric8.knative.flows.v1.ParallelBranchBuilder(this, item);
}
BranchesNestedImpl() {
this.index = -1;
this.builder = new io.fabric8.knative.flows.v1.ParallelBranchBuilder(this);
}
io.fabric8.knative.flows.v1.ParallelBranchBuilder builder;
java.lang.Integer index;
public N and() {
return (N) ParallelSpecFluentImpl.this.setToBranches(index,builder.build());
}
public N endBranch() {
return and();
}
}
public class ChannelTemplateNestedImpl extends io.fabric8.knative.messaging.v1.ChannelTemplateSpecFluentImpl> implements io.fabric8.knative.flows.v1.ParallelSpecFluent.ChannelTemplateNested,io.fabric8.kubernetes.api.builder.Nested{
ChannelTemplateNestedImpl(io.fabric8.knative.messaging.v1.ChannelTemplateSpec item) {
this.builder = new io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder(this, item);
}
ChannelTemplateNestedImpl() {
this.builder = new io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder(this);
}
io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder builder;
public N and() {
return (N) ParallelSpecFluentImpl.this.withChannelTemplate(builder.build());
}
public N endChannelTemplate() {
return and();
}
}
public class ReplyNestedImpl extends io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationFluentImpl> implements io.fabric8.knative.flows.v1.ParallelSpecFluent.ReplyNested,io.fabric8.kubernetes.api.builder.Nested{
ReplyNestedImpl(io.fabric8.knative.internal.pkg.apis.duck.v1.Destination item) {
this.builder = new io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder(this, item);
}
ReplyNestedImpl() {
this.builder = new io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder(this);
}
io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder builder;
public N and() {
return (N) ParallelSpecFluentImpl.this.withReply(builder.build());
}
public N endReply() {
return and();
}
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy