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 * ResourceIdentifier
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     ResourceIdentifier resourceIdentifier = ResourceIdentifier.builder()
024 *             .id("{id}")
025 *             .key("{key}")
026 *             .typeId(ReferenceTypeId.ASSOCIATE_ROLE)
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 = ResourceIdentifierImpl.class)
033public interface ResourceIdentifier {
034
035    /**
036     *
037     * @return id
038     */
039    @NotNull
040    @JsonProperty("id")
041    public String getId();
042
043    /**
044     *
045     * @return key
046     */
047    @NotNull
048    @JsonProperty("key")
049    public String getKey();
050
051    /**
052     *
053     * @return typeId
054     */
055    @NotNull
056    @JsonProperty("typeId")
057    public ReferenceTypeId getTypeId();
058
059    /**
060     * set id
061     * @param id value to be set
062     */
063
064    public void setId(final String id);
065
066    /**
067     * set key
068     * @param key value to be set
069     */
070
071    public void setKey(final String key);
072
073    /**
074     * set typeId
075     * @param typeId value to be set
076     */
077
078    public void setTypeId(final ReferenceTypeId typeId);
079
080    /**
081     * factory method
082     * @return instance of ResourceIdentifier
083     */
084    public static ResourceIdentifier of() {
085        return new ResourceIdentifierImpl();
086    }
087
088    /**
089     * factory method to create a shallow copy ResourceIdentifier
090     * @param template instance to be copied
091     * @return copy instance
092     */
093    public static ResourceIdentifier of(final ResourceIdentifier template) {
094        ResourceIdentifierImpl instance = new ResourceIdentifierImpl();
095        instance.setId(template.getId());
096        instance.setKey(template.getKey());
097        instance.setTypeId(template.getTypeId());
098        return instance;
099    }
100
101    /**
102     * factory method to create a deep copy of ResourceIdentifier
103     * @param template instance to be copied
104     * @return copy instance
105     */
106    @Nullable
107    public static ResourceIdentifier deepCopy(@Nullable final ResourceIdentifier template) {
108        if (template == null) {
109            return null;
110        }
111        ResourceIdentifierImpl instance = new ResourceIdentifierImpl();
112        instance.setId(template.getId());
113        instance.setKey(template.getKey());
114        instance.setTypeId(template.getTypeId());
115        return instance;
116    }
117
118    /**
119     * builder factory method for ResourceIdentifier
120     * @return builder
121     */
122    public static ResourceIdentifierBuilder builder() {
123        return ResourceIdentifierBuilder.of();
124    }
125
126    /**
127     * create builder for ResourceIdentifier instance
128     * @param template instance with prefilled values for the builder
129     * @return builder
130     */
131    public static ResourceIdentifierBuilder builder(final ResourceIdentifier template) {
132        return ResourceIdentifierBuilder.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 withResourceIdentifier(Function<ResourceIdentifier, 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<ResourceIdentifier> typeReference() {
150        return new com.fasterxml.jackson.core.type.TypeReference<ResourceIdentifier>() {
151            @Override
152            public String toString() {
153                return "TypeReference<ResourceIdentifier>";
154            }
155        };
156    }
157}