001
002package com.commercetools.importapi.models.common;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * CartDiscountKeyReferenceBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     CartDiscountKeyReference cartDiscountKeyReference = CartDiscountKeyReference.builder()
016 *             .key("{key}")
017 *             .build()
018 * </code></pre>
019 * </div>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class CartDiscountKeyReferenceBuilder implements Builder<CartDiscountKeyReference> {
023
024    private String key;
025
026    /**
027     * set the value to the key
028     * @param key value to be set
029     * @return Builder
030     */
031
032    public CartDiscountKeyReferenceBuilder key(final String key) {
033        this.key = key;
034        return this;
035    }
036
037    /**
038     * value of key}
039     * @return key
040     */
041
042    public String getKey() {
043        return this.key;
044    }
045
046    /**
047     * builds CartDiscountKeyReference with checking for non-null required values
048     * @return CartDiscountKeyReference
049     */
050    public CartDiscountKeyReference build() {
051        Objects.requireNonNull(key, CartDiscountKeyReference.class + ": key is missing");
052        return new CartDiscountKeyReferenceImpl(key);
053    }
054
055    /**
056     * builds CartDiscountKeyReference without checking for non-null required values
057     * @return CartDiscountKeyReference
058     */
059    public CartDiscountKeyReference buildUnchecked() {
060        return new CartDiscountKeyReferenceImpl(key);
061    }
062
063    /**
064     * factory method for an instance of CartDiscountKeyReferenceBuilder
065     * @return builder
066     */
067    public static CartDiscountKeyReferenceBuilder of() {
068        return new CartDiscountKeyReferenceBuilder();
069    }
070
071    /**
072     * create builder for CartDiscountKeyReference instance
073     * @param template instance with prefilled values for the builder
074     * @return builder
075     */
076    public static CartDiscountKeyReferenceBuilder of(final CartDiscountKeyReference template) {
077        CartDiscountKeyReferenceBuilder builder = new CartDiscountKeyReferenceBuilder();
078        builder.key = template.getKey();
079        return builder;
080    }
081
082}