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

annotations.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 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 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;

public class SequenceSpecFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements io.fabric8.knative.flows.v1.SequenceSpecFluent {

    private io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder channelTemplate;
    private io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder reply;
    private java.util.List steps;

    public SequenceSpecFluentImpl() {
    }

    public SequenceSpecFluentImpl(io.fabric8.knative.flows.v1.SequenceSpec instance) {
        this.withChannelTemplate(instance.getChannelTemplate()); 
        this.withReply(instance.getReply()); 
        this.withSteps(instance.getSteps()); 
    }

    
    @java.lang.Deprecated
        
    /**
     * This method has been deprecated, please use method buildChannelTemplate instead.
     * @return The buildable object.
     */
        public io.fabric8.knative.messaging.v1.ChannelTemplateSpec getChannelTemplate() {
        return this.channelTemplate!=null?this.channelTemplate.build():null;
    }

    public io.fabric8.knative.messaging.v1.ChannelTemplateSpec buildChannelTemplate() {
        return this.channelTemplate!=null?this.channelTemplate.build():null;
    }

    public A withChannelTemplate(io.fabric8.knative.messaging.v1.ChannelTemplateSpec channelTemplate) {
        _visitables.get("channelTemplate").remove(this.channelTemplate);
        if (channelTemplate!=null){ this.channelTemplate= new io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder(channelTemplate); _visitables.get("channelTemplate").add(this.channelTemplate);} return (A) this;
    }

    public java.lang.Boolean hasChannelTemplate() {
        return this.channelTemplate != null;
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.ChannelTemplateNested withNewChannelTemplate() {
        return new io.fabric8.knative.flows.v1.SequenceSpecFluentImpl.ChannelTemplateNestedImpl();
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.ChannelTemplateNested withNewChannelTemplateLike(io.fabric8.knative.messaging.v1.ChannelTemplateSpec item) {
        return new io.fabric8.knative.flows.v1.SequenceSpecFluentImpl.ChannelTemplateNestedImpl(item);
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.ChannelTemplateNested editChannelTemplate() {
        return withNewChannelTemplateLike(getChannelTemplate());
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.ChannelTemplateNested editOrNewChannelTemplate() {
        return withNewChannelTemplateLike(getChannelTemplate() != null ? getChannelTemplate(): new io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder().build());
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.ChannelTemplateNested editOrNewChannelTemplateLike(io.fabric8.knative.messaging.v1.ChannelTemplateSpec item) {
        return withNewChannelTemplateLike(getChannelTemplate() != null ? getChannelTemplate(): item);
    }

    
    @java.lang.Deprecated
        
    /**
     * This method has been deprecated, please use method buildReply instead.
     * @return The buildable object.
     */
        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.SequenceSpecFluent.ReplyNested withNewReply() {
        return new io.fabric8.knative.flows.v1.SequenceSpecFluentImpl.ReplyNestedImpl();
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.ReplyNested withNewReplyLike(io.fabric8.knative.internal.pkg.apis.duck.v1.Destination item) {
        return new io.fabric8.knative.flows.v1.SequenceSpecFluentImpl.ReplyNestedImpl(item);
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.ReplyNested editReply() {
        return withNewReplyLike(getReply());
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.ReplyNested editOrNewReply() {
        return withNewReplyLike(getReply() != null ? getReply(): new io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder().build());
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.ReplyNested editOrNewReplyLike(io.fabric8.knative.internal.pkg.apis.duck.v1.Destination item) {
        return withNewReplyLike(getReply() != null ? getReply(): item);
    }

    public A addToSteps(int index,io.fabric8.knative.flows.v1.SequenceStep item) {
        if (this.steps == null) {this.steps = new java.util.ArrayList();}
        io.fabric8.knative.flows.v1.SequenceStepBuilder builder = new io.fabric8.knative.flows.v1.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(int index,io.fabric8.knative.flows.v1.SequenceStep item) {
        if (this.steps == null) {this.steps = new java.util.ArrayList();}
        io.fabric8.knative.flows.v1.SequenceStepBuilder builder = new io.fabric8.knative.flows.v1.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 java.util.ArrayList();}
        for (io.fabric8.knative.flows.v1.SequenceStep item : items) {io.fabric8.knative.flows.v1.SequenceStepBuilder builder = new io.fabric8.knative.flows.v1.SequenceStepBuilder(item);_visitables.get("steps").add(builder);this.steps.add(builder);} return (A)this;
    }

    public A addAllToSteps(java.util.Collection items) {
        if (this.steps == null) {this.steps = new java.util.ArrayList();}
        for (io.fabric8.knative.flows.v1.SequenceStep item : items) {io.fabric8.knative.flows.v1.SequenceStepBuilder builder = new io.fabric8.knative.flows.v1.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 (io.fabric8.knative.flows.v1.SequenceStep item : items) {io.fabric8.knative.flows.v1.SequenceStepBuilder builder = new io.fabric8.knative.flows.v1.SequenceStepBuilder(item);_visitables.get("steps").remove(builder);if (this.steps != null) {this.steps.remove(builder);}} return (A)this;
    }

    public A removeAllFromSteps(java.util.Collection items) {
        for (io.fabric8.knative.flows.v1.SequenceStep item : items) {io.fabric8.knative.flows.v1.SequenceStepBuilder builder = new io.fabric8.knative.flows.v1.SequenceStepBuilder(item);_visitables.get("steps").remove(builder);if (this.steps != null) {this.steps.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromSteps(java.util.function.Predicate predicate) {
        if (steps == null) return (A) this;
        final Iterator each = steps.iterator();
        final List visitables = _visitables.get("steps");
        while (each.hasNext()) {
          io.fabric8.knative.flows.v1.SequenceStepBuilder builder = each.next();
          if (predicate.test(builder)) {
            visitables.remove(builder);
            each.remove();
          }
        }
        return (A)this;
    }

    
    @java.lang.Deprecated
        
    /**
     * This method has been deprecated, please use method buildSteps instead.
     * @return The buildable object.
     */
        public java.util.List getSteps() {
        return build(steps);
    }

    public java.util.List buildSteps() {
        return build(steps);
    }

    public io.fabric8.knative.flows.v1.SequenceStep buildStep(int index) {
        return this.steps.get(index).build();
    }

    public io.fabric8.knative.flows.v1.SequenceStep buildFirstStep() {
        return this.steps.get(0).build();
    }

    public io.fabric8.knative.flows.v1.SequenceStep buildLastStep() {
        return this.steps.get(steps.size() - 1).build();
    }

    public io.fabric8.knative.flows.v1.SequenceStep buildMatchingStep(java.util.function.Predicate predicate) {
        for (io.fabric8.knative.flows.v1.SequenceStepBuilder item: steps) { if(predicate.test(item)){ return item.build();} } return null;
    }

    public java.lang.Boolean hasMatchingStep(java.util.function.Predicate predicate) {
        for (io.fabric8.knative.flows.v1.SequenceStepBuilder item: steps) { if(predicate.test(item)){ return true;} } return false;
    }

    public A withSteps(java.util.List steps) {
        if (this.steps != null) { _visitables.get("steps").removeAll(this.steps);}
        if (steps != null) {this.steps = new java.util.ArrayList(); for (io.fabric8.knative.flows.v1.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 (io.fabric8.knative.flows.v1.SequenceStep item :steps){ this.addToSteps(item);}} return (A) this;
    }

    public java.lang.Boolean hasSteps() {
        return steps != null && !steps.isEmpty();
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.StepsNested addNewStep() {
        return new io.fabric8.knative.flows.v1.SequenceSpecFluentImpl.StepsNestedImpl();
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.StepsNested addNewStepLike(io.fabric8.knative.flows.v1.SequenceStep item) {
        return new io.fabric8.knative.flows.v1.SequenceSpecFluentImpl.StepsNestedImpl(-1, item);
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.StepsNested setNewStepLike(int index,io.fabric8.knative.flows.v1.SequenceStep item) {
        return new io.fabric8.knative.flows.v1.SequenceSpecFluentImpl.StepsNestedImpl(index, item);
    }

    public io.fabric8.knative.flows.v1.SequenceSpecFluent.StepsNested editStep(int index) {
        if (steps.size() <= index) throw new RuntimeException("Can't edit steps. Index exceeds size.");
        return setNewStepLike(index, buildStep(index));
    }

    public io.fabric8.knative.flows.v1.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 io.fabric8.knative.flows.v1.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 io.fabric8.knative.flows.v1.SequenceSpecFluent.StepsNested editMatchingStep(java.util.function.Predicate predicate) {
        int index = -1;
        for (int i=0;i extends io.fabric8.knative.messaging.v1.ChannelTemplateSpecFluentImpl> implements io.fabric8.knative.flows.v1.SequenceSpecFluent.ChannelTemplateNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.knative.messaging.v1.ChannelTemplateSpecBuilder builder;

            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);
                        
            }

            public N and() {
                return (N) SequenceSpecFluentImpl.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.SequenceSpecFluent.ReplyNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.knative.internal.pkg.apis.duck.v1.DestinationBuilder builder;

            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);
                        
            }

            public N and() {
                return (N) SequenceSpecFluentImpl.this.withReply(builder.build());
            }

            public N endReply() {
                return and();
            }
    }


    public class StepsNestedImpl extends io.fabric8.knative.flows.v1.SequenceStepFluentImpl> implements io.fabric8.knative.flows.v1.SequenceSpecFluent.StepsNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.knative.flows.v1.SequenceStepBuilder builder;
        private final int index;

            StepsNestedImpl(int index,io.fabric8.knative.flows.v1.SequenceStep item) {
                this.index = index;
                this.builder = new io.fabric8.knative.flows.v1.SequenceStepBuilder(this, item);
                        
            }

            StepsNestedImpl() {
                this.index = -1;
                this.builder = new io.fabric8.knative.flows.v1.SequenceStepBuilder(this);
                        
            }

            public N and() {
                return (N) SequenceSpecFluentImpl.this.setToSteps(index,builder.build());
            }

            public N endStep() {
                return and();
            }
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy