001
002package com.commercetools.api.models.common;
003
004import java.util.*;
005import java.util.function.Function;
006
007import javax.annotation.Nullable;
008
009import io.vrap.rmf.base.client.Builder;
010import io.vrap.rmf.base.client.utils.Generated;
011
012/**
013 * LastModifiedByBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     LastModifiedBy lastModifiedBy = LastModifiedBy.builder()
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 LastModifiedByBuilder implements Builder<LastModifiedBy> {
025
026    @Nullable
027    private String clientId;
028
029    @Nullable
030    private String externalUserId;
031
032    @Nullable
033    private com.commercetools.api.models.customer.CustomerReference customer;
034
035    @Nullable
036    private String anonymousId;
037
038    /**
039     *  <p><code>id</code> of the APIClient which modified the resource.</p>
040     * @param clientId value to be set
041     * @return Builder
042     */
043
044    public LastModifiedByBuilder clientId(@Nullable final String clientId) {
045        this.clientId = clientId;
046        return this;
047    }
048
049    /**
050     *  <p>External user ID provided by <code>X-External-User-ID</code> HTTP Header.</p>
051     * @param externalUserId value to be set
052     * @return Builder
053     */
054
055    public LastModifiedByBuilder externalUserId(@Nullable final String externalUserId) {
056        this.externalUserId = externalUserId;
057        return this;
058    }
059
060    /**
061     *  <p>Indicates the Customer who modified the resource using a token from the password flow.</p>
062     * @param builder function to build the customer value
063     * @return Builder
064     */
065
066    public LastModifiedByBuilder customer(
067            Function<com.commercetools.api.models.customer.CustomerReferenceBuilder, com.commercetools.api.models.customer.CustomerReferenceBuilder> builder) {
068        this.customer = builder.apply(com.commercetools.api.models.customer.CustomerReferenceBuilder.of()).build();
069        return this;
070    }
071
072    /**
073     *  <p>Indicates the Customer who modified the resource using a token from the password flow.</p>
074     * @param builder function to build the customer value
075     * @return Builder
076     */
077
078    public LastModifiedByBuilder withCustomer(
079            Function<com.commercetools.api.models.customer.CustomerReferenceBuilder, com.commercetools.api.models.customer.CustomerReference> builder) {
080        this.customer = builder.apply(com.commercetools.api.models.customer.CustomerReferenceBuilder.of());
081        return this;
082    }
083
084    /**
085     *  <p>Indicates the Customer who modified the resource using a token from the password flow.</p>
086     * @param customer value to be set
087     * @return Builder
088     */
089
090    public LastModifiedByBuilder customer(
091            @Nullable final com.commercetools.api.models.customer.CustomerReference customer) {
092        this.customer = customer;
093        return this;
094    }
095
096    /**
097     *  <p>Indicates the anonymous session during which the resource was modified.</p>
098     * @param anonymousId value to be set
099     * @return Builder
100     */
101
102    public LastModifiedByBuilder anonymousId(@Nullable final String anonymousId) {
103        this.anonymousId = anonymousId;
104        return this;
105    }
106
107    /**
108     *  <p><code>id</code> of the APIClient which modified the resource.</p>
109     * @return clientId
110     */
111
112    @Nullable
113    public String getClientId() {
114        return this.clientId;
115    }
116
117    /**
118     *  <p>External user ID provided by <code>X-External-User-ID</code> HTTP Header.</p>
119     * @return externalUserId
120     */
121
122    @Nullable
123    public String getExternalUserId() {
124        return this.externalUserId;
125    }
126
127    /**
128     *  <p>Indicates the Customer who modified the resource using a token from the password flow.</p>
129     * @return customer
130     */
131
132    @Nullable
133    public com.commercetools.api.models.customer.CustomerReference getCustomer() {
134        return this.customer;
135    }
136
137    /**
138     *  <p>Indicates the anonymous session during which the resource was modified.</p>
139     * @return anonymousId
140     */
141
142    @Nullable
143    public String getAnonymousId() {
144        return this.anonymousId;
145    }
146
147    /**
148     * builds LastModifiedBy with checking for non-null required values
149     * @return LastModifiedBy
150     */
151    public LastModifiedBy build() {
152        return new LastModifiedByImpl(clientId, externalUserId, customer, anonymousId);
153    }
154
155    /**
156     * builds LastModifiedBy without checking for non-null required values
157     * @return LastModifiedBy
158     */
159    public LastModifiedBy buildUnchecked() {
160        return new LastModifiedByImpl(clientId, externalUserId, customer, anonymousId);
161    }
162
163    /**
164     * factory method for an instance of LastModifiedByBuilder
165     * @return builder
166     */
167    public static LastModifiedByBuilder of() {
168        return new LastModifiedByBuilder();
169    }
170
171    /**
172     * create builder for LastModifiedBy instance
173     * @param template instance with prefilled values for the builder
174     * @return builder
175     */
176    public static LastModifiedByBuilder of(final LastModifiedBy template) {
177        LastModifiedByBuilder builder = new LastModifiedByBuilder();
178        builder.clientId = template.getClientId();
179        builder.externalUserId = template.getExternalUserId();
180        builder.customer = template.getCustomer();
181        builder.anonymousId = template.getAnonymousId();
182        return builder;
183    }
184
185}