001
002package com.commercetools.api.models.store;
003
004import java.util.*;
005import java.util.function.Function;
006
007import javax.annotation.Nullable;
008
009import io.vrap.rmf.base.client.Builder;
010import io.vrap.rmf.base.client.utils.Generated;
011
012/**
013 * StoreSetSupplyChannelsActionBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     StoreSetSupplyChannelsAction storeSetSupplyChannelsAction = StoreSetSupplyChannelsAction.builder()
019 *             .build()
020 * </code></pre>
021 * </div>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class StoreSetSupplyChannelsActionBuilder implements Builder<StoreSetSupplyChannelsAction> {
025
026    @Nullable
027    private java.util.List<com.commercetools.api.models.channel.ChannelResourceIdentifier> supplyChannels;
028
029    /**
030     *  <p>Value to set. If not defined, the Store's <code>supplyChannels</code> are unset.</p>
031     * @param supplyChannels value to be set
032     * @return Builder
033     */
034
035    public StoreSetSupplyChannelsActionBuilder supplyChannels(
036            @Nullable final com.commercetools.api.models.channel.ChannelResourceIdentifier... supplyChannels) {
037        this.supplyChannels = new ArrayList<>(Arrays.asList(supplyChannels));
038        return this;
039    }
040
041    /**
042     *  <p>Value to set. If not defined, the Store's <code>supplyChannels</code> are unset.</p>
043     * @param supplyChannels value to be set
044     * @return Builder
045     */
046
047    public StoreSetSupplyChannelsActionBuilder supplyChannels(
048            @Nullable final java.util.List<com.commercetools.api.models.channel.ChannelResourceIdentifier> supplyChannels) {
049        this.supplyChannels = supplyChannels;
050        return this;
051    }
052
053    /**
054     *  <p>Value to set. If not defined, the Store's <code>supplyChannels</code> are unset.</p>
055     * @param supplyChannels value to be set
056     * @return Builder
057     */
058
059    public StoreSetSupplyChannelsActionBuilder plusSupplyChannels(
060            @Nullable final com.commercetools.api.models.channel.ChannelResourceIdentifier... supplyChannels) {
061        if (this.supplyChannels == null) {
062            this.supplyChannels = new ArrayList<>();
063        }
064        this.supplyChannels.addAll(Arrays.asList(supplyChannels));
065        return this;
066    }
067
068    /**
069     *  <p>Value to set. If not defined, the Store's <code>supplyChannels</code> are unset.</p>
070     * @param builder function to build the supplyChannels value
071     * @return Builder
072     */
073
074    public StoreSetSupplyChannelsActionBuilder plusSupplyChannels(
075            Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder> builder) {
076        if (this.supplyChannels == null) {
077            this.supplyChannels = new ArrayList<>();
078        }
079        this.supplyChannels
080                .add(builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of()).build());
081        return this;
082    }
083
084    /**
085     *  <p>Value to set. If not defined, the Store's <code>supplyChannels</code> are unset.</p>
086     * @param builder function to build the supplyChannels value
087     * @return Builder
088     */
089
090    public StoreSetSupplyChannelsActionBuilder withSupplyChannels(
091            Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder> builder) {
092        this.supplyChannels = new ArrayList<>();
093        this.supplyChannels
094                .add(builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of()).build());
095        return this;
096    }
097
098    /**
099     *  <p>Value to set. If not defined, the Store's <code>supplyChannels</code> are unset.</p>
100     * @param builder function to build the supplyChannels value
101     * @return Builder
102     */
103
104    public StoreSetSupplyChannelsActionBuilder addSupplyChannels(
105            Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifier> builder) {
106        return plusSupplyChannels(
107            builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of()));
108    }
109
110    /**
111     *  <p>Value to set. If not defined, the Store's <code>supplyChannels</code> are unset.</p>
112     * @param builder function to build the supplyChannels value
113     * @return Builder
114     */
115
116    public StoreSetSupplyChannelsActionBuilder setSupplyChannels(
117            Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifier> builder) {
118        return supplyChannels(
119            builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of()));
120    }
121
122    /**
123     *  <p>Value to set. If not defined, the Store's <code>supplyChannels</code> are unset.</p>
124     * @return supplyChannels
125     */
126
127    @Nullable
128    public java.util.List<com.commercetools.api.models.channel.ChannelResourceIdentifier> getSupplyChannels() {
129        return this.supplyChannels;
130    }
131
132    /**
133     * builds StoreSetSupplyChannelsAction with checking for non-null required values
134     * @return StoreSetSupplyChannelsAction
135     */
136    public StoreSetSupplyChannelsAction build() {
137        return new StoreSetSupplyChannelsActionImpl(supplyChannels);
138    }
139
140    /**
141     * builds StoreSetSupplyChannelsAction without checking for non-null required values
142     * @return StoreSetSupplyChannelsAction
143     */
144    public StoreSetSupplyChannelsAction buildUnchecked() {
145        return new StoreSetSupplyChannelsActionImpl(supplyChannels);
146    }
147
148    /**
149     * factory method for an instance of StoreSetSupplyChannelsActionBuilder
150     * @return builder
151     */
152    public static StoreSetSupplyChannelsActionBuilder of() {
153        return new StoreSetSupplyChannelsActionBuilder();
154    }
155
156    /**
157     * create builder for StoreSetSupplyChannelsAction instance
158     * @param template instance with prefilled values for the builder
159     * @return builder
160     */
161    public static StoreSetSupplyChannelsActionBuilder of(final StoreSetSupplyChannelsAction template) {
162        StoreSetSupplyChannelsActionBuilder builder = new StoreSetSupplyChannelsActionBuilder();
163        builder.supplyChannels = template.getSupplyChannels();
164        return builder;
165    }
166
167}