001
002package com.commercetools.history.models.change_value;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * EnumValueBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     EnumValue enumValue = EnumValue.builder()
016 *             .key("{key}")
017 *             .label("{label}")
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 EnumValueBuilder implements Builder<EnumValue> {
024
025    private String key;
026
027    private String label;
028
029    /**
030     *  <p>Key of the value used as a programmatic identifier.</p>
031     * @param key value to be set
032     * @return Builder
033     */
034
035    public EnumValueBuilder key(final String key) {
036        this.key = key;
037        return this;
038    }
039
040    /**
041     *  <p>Descriptive label of the value.</p>
042     * @param label value to be set
043     * @return Builder
044     */
045
046    public EnumValueBuilder label(final String label) {
047        this.label = label;
048        return this;
049    }
050
051    /**
052     *  <p>Key of the value used as a programmatic identifier.</p>
053     * @return key
054     */
055
056    public String getKey() {
057        return this.key;
058    }
059
060    /**
061     *  <p>Descriptive label of the value.</p>
062     * @return label
063     */
064
065    public String getLabel() {
066        return this.label;
067    }
068
069    /**
070     * builds EnumValue with checking for non-null required values
071     * @return EnumValue
072     */
073    public EnumValue build() {
074        Objects.requireNonNull(key, EnumValue.class + ": key is missing");
075        Objects.requireNonNull(label, EnumValue.class + ": label is missing");
076        return new EnumValueImpl(key, label);
077    }
078
079    /**
080     * builds EnumValue without checking for non-null required values
081     * @return EnumValue
082     */
083    public EnumValue buildUnchecked() {
084        return new EnumValueImpl(key, label);
085    }
086
087    /**
088     * factory method for an instance of EnumValueBuilder
089     * @return builder
090     */
091    public static EnumValueBuilder of() {
092        return new EnumValueBuilder();
093    }
094
095    /**
096     * create builder for EnumValue instance
097     * @param template instance with prefilled values for the builder
098     * @return builder
099     */
100    public static EnumValueBuilder of(final EnumValue template) {
101        EnumValueBuilder builder = new EnumValueBuilder();
102        builder.key = template.getKey();
103        builder.label = template.getLabel();
104        return builder;
105    }
106
107}