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     */
030
031    public ImageSearchConfigRequestBuilder actions(
032            final com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction... actions) {
033        this.actions = new ArrayList<>(Arrays.asList(actions));
034        return this;
035    }
036
037    /**
038     *  <p>The list of update actions to be performed on the project.</p>
039     */
040
041    public ImageSearchConfigRequestBuilder actions(
042            final java.util.List<com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction> actions) {
043        this.actions = actions;
044        return this;
045    }
046
047    /**
048     *  <p>The list of update actions to be performed on the project.</p>
049     */
050
051    public ImageSearchConfigRequestBuilder plusActions(
052            final com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction... actions) {
053        if (this.actions == null) {
054            this.actions = new ArrayList<>();
055        }
056        this.actions.addAll(Arrays.asList(actions));
057        return this;
058    }
059
060    /**
061     *  <p>The list of update actions to be performed on the project.</p>
062     */
063
064    public ImageSearchConfigRequestBuilder plusActions(
065            Function<com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateActionBuilder, Builder<? extends com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction>> builder) {
066        if (this.actions == null) {
067            this.actions = new ArrayList<>();
068        }
069        this.actions.add(
070            builder.apply(com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateActionBuilder.of())
071                    .build());
072        return this;
073    }
074
075    /**
076     *  <p>The list of update actions to be performed on the project.</p>
077     */
078
079    public ImageSearchConfigRequestBuilder withActions(
080            Function<com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateActionBuilder, Builder<? extends com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction>> builder) {
081        this.actions = new ArrayList<>();
082        this.actions.add(
083            builder.apply(com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateActionBuilder.of())
084                    .build());
085        return this;
086    }
087
088    public java.util.List<com.commercetools.ml.models.image_search_config.ImageSearchConfigUpdateAction> getActions() {
089        return this.actions;
090    }
091
092    public ImageSearchConfigRequest build() {
093        Objects.requireNonNull(actions, ImageSearchConfigRequest.class + ": actions is missing");
094        return new ImageSearchConfigRequestImpl(actions);
095    }
096
097    /**
098     * builds ImageSearchConfigRequest without checking for non null required values
099     */
100    public ImageSearchConfigRequest buildUnchecked() {
101        return new ImageSearchConfigRequestImpl(actions);
102    }
103
104    public static ImageSearchConfigRequestBuilder of() {
105        return new ImageSearchConfigRequestBuilder();
106    }
107
108    public static ImageSearchConfigRequestBuilder of(final ImageSearchConfigRequest template) {
109        ImageSearchConfigRequestBuilder builder = new ImageSearchConfigRequestBuilder();
110        builder.actions = template.getActions();
111        return builder;
112    }
113
114}