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