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

io.fabric8.knative.flows.v1.SequenceSpecFluentImpl 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 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.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
  */
  @SuppressWarnings(value = "unchecked")
  public class SequenceSpecFluentImpl> extends BaseFluent implements SequenceSpecFluent{
  public SequenceSpecFluentImpl() {
  }
  public SequenceSpecFluentImpl(SequenceSpec instance) {
    this.withChannelTemplate(instance.getChannelTemplate()); 
    this.withReply(instance.getReply()); 
    this.withSteps(instance.getSteps()); 
  }
  private ChannelTemplateSpecBuilder channelTemplate;
  private DestinationBuilder reply;
  private ArrayList steps = new ArrayList();
  
  /**
   * This method has been deprecated, please use method buildChannelTemplate instead.
   * @return The buildable object.
   */
  @Deprecated
  public ChannelTemplateSpec getChannelTemplate() {
    return this.channelTemplate!=null ?this.channelTemplate.build():null;
  }
  public ChannelTemplateSpec buildChannelTemplate() {
    return this.channelTemplate!=null ?this.channelTemplate.build():null;
  }
  public A withChannelTemplate(ChannelTemplateSpec channelTemplate) {
    _visitables.get("channelTemplate").remove(this.channelTemplate);
    if (channelTemplate!=null){ this.channelTemplate= new ChannelTemplateSpecBuilder(channelTemplate); _visitables.get("channelTemplate").add(this.channelTemplate);} else { this.channelTemplate = null; _visitables.get("channelTemplate").remove(this.channelTemplate); } return (A) this;
  }
  public Boolean hasChannelTemplate() {
    return this.channelTemplate != null;
  }
  public SequenceSpecFluent.ChannelTemplateNested withNewChannelTemplate() {
    return new SequenceSpecFluentImpl.ChannelTemplateNestedImpl();
  }
  public SequenceSpecFluent.ChannelTemplateNested withNewChannelTemplateLike(ChannelTemplateSpec item) {
    return new SequenceSpecFluentImpl.ChannelTemplateNestedImpl(item);
  }
  public SequenceSpecFluent.ChannelTemplateNested editChannelTemplate() {
    return withNewChannelTemplateLike(getChannelTemplate());
  }
  public SequenceSpecFluent.ChannelTemplateNested editOrNewChannelTemplate() {
    return withNewChannelTemplateLike(getChannelTemplate() != null ? getChannelTemplate(): new ChannelTemplateSpecBuilder().build());
  }
  public SequenceSpecFluent.ChannelTemplateNested editOrNewChannelTemplateLike(ChannelTemplateSpec item) {
    return withNewChannelTemplateLike(getChannelTemplate() != null ? getChannelTemplate(): item);
  }
  
  /**
   * This method has been deprecated, please use method buildReply instead.
   * @return The buildable object.
   */
  @Deprecated
  public Destination getReply() {
    return this.reply!=null ?this.reply.build():null;
  }
  public Destination buildReply() {
    return this.reply!=null ?this.reply.build():null;
  }
  public A withReply(Destination reply) {
    _visitables.get("reply").remove(this.reply);
    if (reply!=null){ this.reply= new DestinationBuilder(reply); _visitables.get("reply").add(this.reply);} else { this.reply = null; _visitables.get("reply").remove(this.reply); } return (A) this;
  }
  public Boolean hasReply() {
    return this.reply != null;
  }
  public SequenceSpecFluent.ReplyNested withNewReply() {
    return new SequenceSpecFluentImpl.ReplyNestedImpl();
  }
  public SequenceSpecFluent.ReplyNested withNewReplyLike(Destination item) {
    return new SequenceSpecFluentImpl.ReplyNestedImpl(item);
  }
  public SequenceSpecFluent.ReplyNested editReply() {
    return withNewReplyLike(getReply());
  }
  public SequenceSpecFluent.ReplyNested editOrNewReply() {
    return withNewReplyLike(getReply() != null ? getReply(): new DestinationBuilder().build());
  }
  public SequenceSpecFluent.ReplyNested editOrNewReplyLike(Destination item) {
    return withNewReplyLike(getReply() != null ? getReply(): item);
  }
  public A addToSteps(Integer index,SequenceStep item) {
    if (this.steps == null) {this.steps = new ArrayList();}
    SequenceStepBuilder builder = new SequenceStepBuilder(item);_visitables.get("steps").add(index >= 0 ? index : _visitables.get("steps").size(), builder);this.steps.add(index >= 0 ? index : steps.size(), builder); return (A)this;
  }
  public A setToSteps(Integer index,SequenceStep item) {
    if (this.steps == null) {this.steps = new ArrayList();}
    SequenceStepBuilder builder = new SequenceStepBuilder(item);
    if (index < 0 || index >= _visitables.get("steps").size()) { _visitables.get("steps").add(builder); } else { _visitables.get("steps").set(index, builder);}
    if (index < 0 || index >= steps.size()) { steps.add(builder); } else { 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) {
    for (SequenceStep item : items) {SequenceStepBuilder builder = new SequenceStepBuilder(item);_visitables.get("steps").remove(builder);if (this.steps != null) {this.steps.remove(builder);}} return (A)this;
  }
  public A removeAllFromSteps(Collection items) {
    for (SequenceStep item : items) {SequenceStepBuilder builder = new SequenceStepBuilder(item);_visitables.get("steps").remove(builder);if (this.steps != null) {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;
  }
  
  /**
   * This method has been deprecated, please use method buildSteps instead.
   * @return The buildable object.
   */
  @Deprecated
  public List getSteps() {
    return steps != null ? build(steps) : null;
  }
  public List buildSteps() {
    return steps != null ? build(steps) : null;
  }
  public SequenceStep buildStep(Integer 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) { _visitables.get("steps").removeAll(this.steps);}
    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();}
    if (steps != null) {for (SequenceStep item :steps){ this.addToSteps(item);}} return (A) this;
  }
  public Boolean hasSteps() {
    return steps != null && !steps.isEmpty();
  }
  public SequenceSpecFluent.StepsNested addNewStep() {
    return new SequenceSpecFluentImpl.StepsNestedImpl();
  }
  public SequenceSpecFluent.StepsNested addNewStepLike(SequenceStep item) {
    return new SequenceSpecFluentImpl.StepsNestedImpl(-1, item);
  }
  public SequenceSpecFluent.StepsNested setNewStepLike(Integer index,SequenceStep item) {
    return new SequenceSpecFluentImpl.StepsNestedImpl(index, item);
  }
  public SequenceSpecFluent.StepsNested editStep(Integer index) {
    if (steps.size() <= index) throw new RuntimeException("Can't edit steps. Index exceeds size.");
    return setNewStepLike(index, buildStep(index));
  }
  public SequenceSpecFluent.StepsNested editFirstStep() {
    if (steps.size() == 0) throw new RuntimeException("Can't edit first steps. The list is empty.");
    return setNewStepLike(0, buildStep(0));
  }
  public SequenceSpecFluent.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 SequenceSpecFluent.StepsNested editMatchingStep(Predicate predicate) {
    int index = -1;
    for (int i=0;i extends ChannelTemplateSpecFluentImpl> implements SequenceSpecFluent.ChannelTemplateNested,Nested{
    ChannelTemplateNestedImpl(ChannelTemplateSpec item) {
      this.builder = new ChannelTemplateSpecBuilder(this, item);
    }
    ChannelTemplateNestedImpl() {
      this.builder = new ChannelTemplateSpecBuilder(this);
    }
    ChannelTemplateSpecBuilder builder;
    public N and() {
      return (N) SequenceSpecFluentImpl.this.withChannelTemplate(builder.build());
    }
    public N endChannelTemplate() {
      return and();
    }
    
  }
  class ReplyNestedImpl extends DestinationFluentImpl> implements SequenceSpecFluent.ReplyNested,Nested{
    ReplyNestedImpl(Destination item) {
      this.builder = new DestinationBuilder(this, item);
    }
    ReplyNestedImpl() {
      this.builder = new DestinationBuilder(this);
    }
    DestinationBuilder builder;
    public N and() {
      return (N) SequenceSpecFluentImpl.this.withReply(builder.build());
    }
    public N endReply() {
      return and();
    }
    
  }
  class StepsNestedImpl extends SequenceStepFluentImpl> implements SequenceSpecFluent.StepsNested,Nested{
    StepsNestedImpl(Integer index,SequenceStep item) {
      this.index = index;
      this.builder = new SequenceStepBuilder(this, item);
    }
    StepsNestedImpl() {
      this.index = -1;
      this.builder = new SequenceStepBuilder(this);
    }
    SequenceStepBuilder builder;
    Integer index;
    public N and() {
      return (N) SequenceSpecFluentImpl.this.setToSteps(index,builder.build());
    }
    public N endStep() {
      return and();
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy