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