001
002package com.commercetools.api.models.shopping_list;
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 * ShoppingListChangeNameActionBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     ShoppingListChangeNameAction shoppingListChangeNameAction = ShoppingListChangeNameAction.builder()
017 *             .name(nameBuilder -> nameBuilder)
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 ShoppingListChangeNameActionBuilder implements Builder<ShoppingListChangeNameAction> {
024
025    private com.commercetools.api.models.common.LocalizedString name;
026
027    /**
028     *  <p>New value to set. Must not be empty.</p>
029     * @param builder function to build the name value
030     * @return Builder
031     */
032
033    public ShoppingListChangeNameActionBuilder name(
034            Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedStringBuilder> builder) {
035        this.name = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of()).build();
036        return this;
037    }
038
039    /**
040     *  <p>New value to set. Must not be empty.</p>
041     * @param builder function to build the name value
042     * @return Builder
043     */
044
045    public ShoppingListChangeNameActionBuilder withName(
046            Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedString> builder) {
047        this.name = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of());
048        return this;
049    }
050
051    /**
052     *  <p>New value to set. Must not be empty.</p>
053     * @param name value to be set
054     * @return Builder
055     */
056
057    public ShoppingListChangeNameActionBuilder name(final com.commercetools.api.models.common.LocalizedString name) {
058        this.name = name;
059        return this;
060    }
061
062    /**
063     *  <p>New value to set. Must not be empty.</p>
064     * @return name
065     */
066
067    public com.commercetools.api.models.common.LocalizedString getName() {
068        return this.name;
069    }
070
071    /**
072     * builds ShoppingListChangeNameAction with checking for non-null required values
073     * @return ShoppingListChangeNameAction
074     */
075    public ShoppingListChangeNameAction build() {
076        Objects.requireNonNull(name, ShoppingListChangeNameAction.class + ": name is missing");
077        return new ShoppingListChangeNameActionImpl(name);
078    }
079
080    /**
081     * builds ShoppingListChangeNameAction without checking for non-null required values
082     * @return ShoppingListChangeNameAction
083     */
084    public ShoppingListChangeNameAction buildUnchecked() {
085        return new ShoppingListChangeNameActionImpl(name);
086    }
087
088    /**
089     * factory method for an instance of ShoppingListChangeNameActionBuilder
090     * @return builder
091     */
092    public static ShoppingListChangeNameActionBuilder of() {
093        return new ShoppingListChangeNameActionBuilder();
094    }
095
096    /**
097     * create builder for ShoppingListChangeNameAction instance
098     * @param template instance with prefilled values for the builder
099     * @return builder
100     */
101    public static ShoppingListChangeNameActionBuilder of(final ShoppingListChangeNameAction template) {
102        ShoppingListChangeNameActionBuilder builder = new ShoppingListChangeNameActionBuilder();
103        builder.name = template.getName();
104        return builder;
105    }
106
107}