001
002package com.commercetools.history.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 * ResourceIdentifierBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     ResourceIdentifier resourceIdentifier = ResourceIdentifier.builder()
016 *             .id("{id}")
017 *             .key("{key}")
018 *             .typeId(ReferenceTypeId.ASSOCIATE_ROLE)
019 *             .build()
020 * </code></pre>
021 * </div>
022 */
023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
024public class ResourceIdentifierBuilder implements Builder<ResourceIdentifier> {
025
026    private String id;
027
028    private String key;
029
030    private com.commercetools.history.models.common.ReferenceTypeId typeId;
031
032    /**
033     * set the value to the id
034     * @param id value to be set
035     * @return Builder
036     */
037
038    public ResourceIdentifierBuilder id(final String id) {
039        this.id = id;
040        return this;
041    }
042
043    /**
044     * set the value to the key
045     * @param key value to be set
046     * @return Builder
047     */
048
049    public ResourceIdentifierBuilder key(final String key) {
050        this.key = key;
051        return this;
052    }
053
054    /**
055     * set the value to the typeId
056     * @param typeId value to be set
057     * @return Builder
058     */
059
060    public ResourceIdentifierBuilder typeId(final com.commercetools.history.models.common.ReferenceTypeId typeId) {
061        this.typeId = typeId;
062        return this;
063    }
064
065    /**
066     * value of id}
067     * @return id
068     */
069
070    public String getId() {
071        return this.id;
072    }
073
074    /**
075     * value of key}
076     * @return key
077     */
078
079    public String getKey() {
080        return this.key;
081    }
082
083    /**
084     * value of typeId}
085     * @return typeId
086     */
087
088    public com.commercetools.history.models.common.ReferenceTypeId getTypeId() {
089        return this.typeId;
090    }
091
092    /**
093     * builds ResourceIdentifier with checking for non-null required values
094     * @return ResourceIdentifier
095     */
096    public ResourceIdentifier build() {
097        Objects.requireNonNull(id, ResourceIdentifier.class + ": id is missing");
098        Objects.requireNonNull(key, ResourceIdentifier.class + ": key is missing");
099        Objects.requireNonNull(typeId, ResourceIdentifier.class + ": typeId is missing");
100        return new ResourceIdentifierImpl(id, key, typeId);
101    }
102
103    /**
104     * builds ResourceIdentifier without checking for non-null required values
105     * @return ResourceIdentifier
106     */
107    public ResourceIdentifier buildUnchecked() {
108        return new ResourceIdentifierImpl(id, key, typeId);
109    }
110
111    /**
112     * factory method for an instance of ResourceIdentifierBuilder
113     * @return builder
114     */
115    public static ResourceIdentifierBuilder of() {
116        return new ResourceIdentifierBuilder();
117    }
118
119    /**
120     * create builder for ResourceIdentifier instance
121     * @param template instance with prefilled values for the builder
122     * @return builder
123     */
124    public static ResourceIdentifierBuilder of(final ResourceIdentifier template) {
125        ResourceIdentifierBuilder builder = new ResourceIdentifierBuilder();
126        builder.id = template.getId();
127        builder.key = template.getKey();
128        builder.typeId = template.getTypeId();
129        return builder;
130    }
131
132}