001
002package com.commercetools.ml.models.image_search_config;
003
004import java.util.*;
005import java.util.function.Function;
006
007import io.vrap.rmf.base.client.Builder;
008import io.vrap.rmf.base.client.utils.Generated;
009
010/**
011 * ImageSearchConfigRequestBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     ImageSearchConfigRequest imageSearchConfigRequest = ImageSearchConfigRequest.builder()
017 *             .plusActions(actionsBuilder -> actionsBuilder)
018 *             .build()
019 * </code></pre>
020 * </div>
021 */
022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
023public class ImageSearchConfigRequestBuilder implements Builder<ImageSearchConfigRequest> {
024
025    private java.util.List<com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction> actions;
026
027    /**
028     *  <p>The list of update actions to be performed on the project.</p>
029     * @param actions value to be set
030     * @return Builder
031     */
032
033    public ImageSearchConfigRequestBuilder actions(
034            final com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction... actions) {
035        this.actions = new ArrayList<>(Arrays.asList(actions));
036        return this;
037    }
038
039    /**
040     *  <p>The list of update actions to be performed on the project.</p>
041     * @param actions value to be set
042     * @return Builder
043     */
044
045    public ImageSearchConfigRequestBuilder actions(
046            final java.util.List<com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction> actions) {
047        this.actions = actions;
048        return this;
049    }
050
051    /**
052     *  <p>The list of update actions to be performed on the project.</p>
053     * @param actions value to be set
054     * @return Builder
055     */
056
057    public ImageSearchConfigRequestBuilder plusActions(
058            final com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction... actions) {
059        if (this.actions == null) {
060            this.actions = new ArrayList<>();
061        }
062        this.actions.addAll(Arrays.asList(actions));
063        return this;
064    }
065
066    /**
067     *  <p>The list of update actions to be performed on the project.</p>
068     * @param builder function to build the actions value
069     * @return Builder
070     */
071
072    public ImageSearchConfigRequestBuilder plusActions(
073            Function<com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateActionBuilder, Builder<? extends com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction>> builder) {
074        if (this.actions == null) {
075            this.actions = new ArrayList<>();
076        }
077        this.actions.add(
078            builder.apply(com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateActionBuilder.of())
079                    .build());
080        return this;
081    }
082
083    /**
084     *  <p>The list of update actions to be performed on the project.</p>
085     * @param builder function to build the actions value
086     * @return Builder
087     */
088
089    public ImageSearchConfigRequestBuilder withActions(
090            Function<com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateActionBuilder, Builder<? extends com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction>> builder) {
091        this.actions = new ArrayList<>();
092        this.actions.add(
093            builder.apply(com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateActionBuilder.of())
094                    .build());
095        return this;
096    }
097
098    /**
099     *  <p>The list of update actions to be performed on the project.</p>
100     * @return actions
101     */
102
103    public java.util.List<com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction> getActions() {
104        return this.actions;
105    }
106
107    /**
108     * builds ImageSearchConfigRequest with checking for non-null required values
109     * @return ImageSearchConfigRequest
110     */
111    public ImageSearchConfigRequest build() {
112        Objects.requireNonNull(actions, ImageSearchConfigRequest.class + ": actions is missing");
113        return new ImageSearchConfigRequestImpl(actions);
114    }
115
116    /**
117     * builds ImageSearchConfigRequest without checking for non-null required values
118     * @return ImageSearchConfigRequest
119     */
120    public ImageSearchConfigRequest buildUnchecked() {
121        return new ImageSearchConfigRequestImpl(actions);
122    }
123
124    /**
125     * factory method for an instance of ImageSearchConfigRequestBuilder
126     * @return builder
127     */
128    public static ImageSearchConfigRequestBuilder of() {
129        return new ImageSearchConfigRequestBuilder();
130    }
131
132    /**
133     * create builder for ImageSearchConfigRequest instance
134     * @param template instance with prefilled values for the builder
135     * @return builder
136     */
137    public static ImageSearchConfigRequestBuilder of(final ImageSearchConfigRequest template) {
138        ImageSearchConfigRequestBuilder builder = new ImageSearchConfigRequestBuilder();
139        builder.actions = template.getActions();
140        return builder;
141    }
142
143}