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 * TypeKeyReferenceBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     TypeKeyReference typeKeyReference = TypeKeyReference.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 TypeKeyReferenceBuilder implements Builder<TypeKeyReference> {
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 TypeKeyReferenceBuilder 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 TypeKeyReference with checking for non-null required values
048     * @return TypeKeyReference
049     */
050    public TypeKeyReference build() {
051        Objects.requireNonNull(key, TypeKeyReference.class + ": key is missing");
052        return new TypeKeyReferenceImpl(key);
053    }
054
055    /**
056     * builds TypeKeyReference without checking for non-null required values
057     * @return TypeKeyReference
058     */
059    public TypeKeyReference buildUnchecked() {
060        return new TypeKeyReferenceImpl(key);
061    }
062
063    /**
064     * factory method for an instance of TypeKeyReferenceBuilder
065     * @return builder
066     */
067    public static TypeKeyReferenceBuilder of() {
068        return new TypeKeyReferenceBuilder();
069    }
070
071    /**
072     * create builder for TypeKeyReference instance
073     * @param template instance with prefilled values for the builder
074     * @return builder
075     */
076    public static TypeKeyReferenceBuilder of(final TypeKeyReference template) {
077        TypeKeyReferenceBuilder builder = new TypeKeyReferenceBuilder();
078        builder.key = template.getKey();
079        return builder;
080    }
081
082}