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 * StoreSetCountriesActionBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     StoreSetCountriesAction storeSetCountriesAction = StoreSetCountriesAction.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 StoreSetCountriesActionBuilder implements Builder<StoreSetCountriesAction> {
025
026    @Nullable
027    private java.util.List<com.commercetools.api.models.store_country.StoreCountry> countries;
028
029    /**
030     *  <p>New value to set.</p>
031     * @param countries value to be set
032     * @return Builder
033     */
034
035    public StoreSetCountriesActionBuilder countries(
036            @Nullable final com.commercetools.api.models.store_country.StoreCountry... countries) {
037        this.countries = new ArrayList<>(Arrays.asList(countries));
038        return this;
039    }
040
041    /**
042     *  <p>New value to set.</p>
043     * @param countries value to be set
044     * @return Builder
045     */
046
047    public StoreSetCountriesActionBuilder countries(
048            @Nullable final java.util.List<com.commercetools.api.models.store_country.StoreCountry> countries) {
049        this.countries = countries;
050        return this;
051    }
052
053    /**
054     *  <p>New value to set.</p>
055     * @param countries value to be set
056     * @return Builder
057     */
058
059    public StoreSetCountriesActionBuilder plusCountries(
060            @Nullable final com.commercetools.api.models.store_country.StoreCountry... countries) {
061        if (this.countries == null) {
062            this.countries = new ArrayList<>();
063        }
064        this.countries.addAll(Arrays.asList(countries));
065        return this;
066    }
067
068    /**
069     *  <p>New value to set.</p>
070     * @param builder function to build the countries value
071     * @return Builder
072     */
073
074    public StoreSetCountriesActionBuilder plusCountries(
075            Function<com.commercetools.api.models.store_country.StoreCountryBuilder, com.commercetools.api.models.store_country.StoreCountryBuilder> builder) {
076        if (this.countries == null) {
077            this.countries = new ArrayList<>();
078        }
079        this.countries.add(builder.apply(com.commercetools.api.models.store_country.StoreCountryBuilder.of()).build());
080        return this;
081    }
082
083    /**
084     *  <p>New value to set.</p>
085     * @param builder function to build the countries value
086     * @return Builder
087     */
088
089    public StoreSetCountriesActionBuilder withCountries(
090            Function<com.commercetools.api.models.store_country.StoreCountryBuilder, com.commercetools.api.models.store_country.StoreCountryBuilder> builder) {
091        this.countries = new ArrayList<>();
092        this.countries.add(builder.apply(com.commercetools.api.models.store_country.StoreCountryBuilder.of()).build());
093        return this;
094    }
095
096    /**
097     *  <p>New value to set.</p>
098     * @param builder function to build the countries value
099     * @return Builder
100     */
101
102    public StoreSetCountriesActionBuilder addCountries(
103            Function<com.commercetools.api.models.store_country.StoreCountryBuilder, com.commercetools.api.models.store_country.StoreCountry> builder) {
104        return plusCountries(builder.apply(com.commercetools.api.models.store_country.StoreCountryBuilder.of()));
105    }
106
107    /**
108     *  <p>New value to set.</p>
109     * @param builder function to build the countries value
110     * @return Builder
111     */
112
113    public StoreSetCountriesActionBuilder setCountries(
114            Function<com.commercetools.api.models.store_country.StoreCountryBuilder, com.commercetools.api.models.store_country.StoreCountry> builder) {
115        return countries(builder.apply(com.commercetools.api.models.store_country.StoreCountryBuilder.of()));
116    }
117
118    /**
119     *  <p>New value to set.</p>
120     * @return countries
121     */
122
123    @Nullable
124    public java.util.List<com.commercetools.api.models.store_country.StoreCountry> getCountries() {
125        return this.countries;
126    }
127
128    /**
129     * builds StoreSetCountriesAction with checking for non-null required values
130     * @return StoreSetCountriesAction
131     */
132    public StoreSetCountriesAction build() {
133        return new StoreSetCountriesActionImpl(countries);
134    }
135
136    /**
137     * builds StoreSetCountriesAction without checking for non-null required values
138     * @return StoreSetCountriesAction
139     */
140    public StoreSetCountriesAction buildUnchecked() {
141        return new StoreSetCountriesActionImpl(countries);
142    }
143
144    /**
145     * factory method for an instance of StoreSetCountriesActionBuilder
146     * @return builder
147     */
148    public static StoreSetCountriesActionBuilder of() {
149        return new StoreSetCountriesActionBuilder();
150    }
151
152    /**
153     * create builder for StoreSetCountriesAction instance
154     * @param template instance with prefilled values for the builder
155     * @return builder
156     */
157    public static StoreSetCountriesActionBuilder of(final StoreSetCountriesAction template) {
158        StoreSetCountriesActionBuilder builder = new StoreSetCountriesActionBuilder();
159        builder.countries = template.getCountries();
160        return builder;
161    }
162
163}