001
002package com.commercetools.history.models.common;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.constraints.NotNull;
010
011import com.fasterxml.jackson.annotation.*;
012import com.fasterxml.jackson.databind.annotation.*;
013
014import io.vrap.rmf.base.client.utils.Generated;
015
016/**
017 * Variant
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     Variant variant = Variant.builder()
024 *             .id(1)
025 *             .sku("{sku}")
026 *             .key("{key}")
027 *             .build()
028 * </code></pre>
029 * </div>
030 */
031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
032@JsonDeserialize(as = VariantImpl.class)
033public interface Variant {
034
035    /**
036     *
037     * @return id
038     */
039    @NotNull
040    @JsonProperty("id")
041    public Integer getId();
042
043    /**
044     *
045     * @return sku
046     */
047    @NotNull
048    @JsonProperty("sku")
049    public String getSku();
050
051    /**
052     *
053     * @return key
054     */
055    @NotNull
056    @JsonProperty("key")
057    public String getKey();
058
059    /**
060     * set id
061     * @param id value to be set
062     */
063
064    public void setId(final Integer id);
065
066    /**
067     * set sku
068     * @param sku value to be set
069     */
070
071    public void setSku(final String sku);
072
073    /**
074     * set key
075     * @param key value to be set
076     */
077
078    public void setKey(final String key);
079
080    /**
081     * factory method
082     * @return instance of Variant
083     */
084    public static Variant of() {
085        return new VariantImpl();
086    }
087
088    /**
089     * factory method to create a shallow copy Variant
090     * @param template instance to be copied
091     * @return copy instance
092     */
093    public static Variant of(final Variant template) {
094        VariantImpl instance = new VariantImpl();
095        instance.setId(template.getId());
096        instance.setSku(template.getSku());
097        instance.setKey(template.getKey());
098        return instance;
099    }
100
101    /**
102     * factory method to create a deep copy of Variant
103     * @param template instance to be copied
104     * @return copy instance
105     */
106    @Nullable
107    public static Variant deepCopy(@Nullable final Variant template) {
108        if (template == null) {
109            return null;
110        }
111        VariantImpl instance = new VariantImpl();
112        instance.setId(template.getId());
113        instance.setSku(template.getSku());
114        instance.setKey(template.getKey());
115        return instance;
116    }
117
118    /**
119     * builder factory method for Variant
120     * @return builder
121     */
122    public static VariantBuilder builder() {
123        return VariantBuilder.of();
124    }
125
126    /**
127     * create builder for Variant instance
128     * @param template instance with prefilled values for the builder
129     * @return builder
130     */
131    public static VariantBuilder builder(final Variant template) {
132        return VariantBuilder.of(template);
133    }
134
135    /**
136     * accessor map function
137     * @param <T> mapped type
138     * @param helper function to map the object
139     * @return mapped value
140     */
141    default <T> T withVariant(Function<Variant, T> helper) {
142        return helper.apply(this);
143    }
144
145    /**
146     * gives a TypeReference for usage with Jackson DataBind
147     * @return TypeReference
148     */
149    public static com.fasterxml.jackson.core.type.TypeReference<Variant> typeReference() {
150        return new com.fasterxml.jackson.core.type.TypeReference<Variant>() {
151            @Override
152            public String toString() {
153                return "TypeReference<Variant>";
154            }
155        };
156    }
157}