001
002package com.commercetools.history.models.common;
003
004import java.util.*;
005import java.util.function.Function;
006
007import io.vrap.rmf.base.client.Builder;
008import io.vrap.rmf.base.client.utils.Generated;
009
010/**
011 * SyncInfoBuilder
012 * <hr>
013 * Example to create an instance using the builder pattern
014 * <div class=code-example>
015 * <pre><code class='java'>
016 *     SyncInfo syncInfo = SyncInfo.builder()
017 *             .channel(channelBuilder -> channelBuilder)
018 *             .externalId("{externalId}")
019 *             .syncedAt("{syncedAt}")
020 *             .build()
021 * </code></pre>
022 * </div>
023 */
024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
025public class SyncInfoBuilder implements Builder<SyncInfo> {
026
027    private com.commercetools.history.models.common.Reference channel;
028
029    private String externalId;
030
031    private String syncedAt;
032
033    /**
034     * set the value to the channel using the builder function
035     * @param builder function to build the channel value
036     * @return Builder
037     */
038
039    public SyncInfoBuilder channel(
040            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) {
041        this.channel = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build();
042        return this;
043    }
044
045    /**
046     * set the value to the channel using the builder function
047     * @param builder function to build the channel value
048     * @return Builder
049     */
050
051    public SyncInfoBuilder withChannel(
052            Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) {
053        this.channel = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of());
054        return this;
055    }
056
057    /**
058     * set the value to the channel
059     * @param channel value to be set
060     * @return Builder
061     */
062
063    public SyncInfoBuilder channel(final com.commercetools.history.models.common.Reference channel) {
064        this.channel = channel;
065        return this;
066    }
067
068    /**
069     *  <p>Can be used to reference an external order instance, file etc.</p>
070     * @param externalId value to be set
071     * @return Builder
072     */
073
074    public SyncInfoBuilder externalId(final String externalId) {
075        this.externalId = externalId;
076        return this;
077    }
078
079    /**
080     * set the value to the syncedAt
081     * @param syncedAt value to be set
082     * @return Builder
083     */
084
085    public SyncInfoBuilder syncedAt(final String syncedAt) {
086        this.syncedAt = syncedAt;
087        return this;
088    }
089
090    /**
091     * value of channel}
092     * @return channel
093     */
094
095    public com.commercetools.history.models.common.Reference getChannel() {
096        return this.channel;
097    }
098
099    /**
100     *  <p>Can be used to reference an external order instance, file etc.</p>
101     * @return externalId
102     */
103
104    public String getExternalId() {
105        return this.externalId;
106    }
107
108    /**
109     * value of syncedAt}
110     * @return syncedAt
111     */
112
113    public String getSyncedAt() {
114        return this.syncedAt;
115    }
116
117    /**
118     * builds SyncInfo with checking for non-null required values
119     * @return SyncInfo
120     */
121    public SyncInfo build() {
122        Objects.requireNonNull(channel, SyncInfo.class + ": channel is missing");
123        Objects.requireNonNull(externalId, SyncInfo.class + ": externalId is missing");
124        Objects.requireNonNull(syncedAt, SyncInfo.class + ": syncedAt is missing");
125        return new SyncInfoImpl(channel, externalId, syncedAt);
126    }
127
128    /**
129     * builds SyncInfo without checking for non-null required values
130     * @return SyncInfo
131     */
132    public SyncInfo buildUnchecked() {
133        return new SyncInfoImpl(channel, externalId, syncedAt);
134    }
135
136    /**
137     * factory method for an instance of SyncInfoBuilder
138     * @return builder
139     */
140    public static SyncInfoBuilder of() {
141        return new SyncInfoBuilder();
142    }
143
144    /**
145     * create builder for SyncInfo instance
146     * @param template instance with prefilled values for the builder
147     * @return builder
148     */
149    public static SyncInfoBuilder of(final SyncInfo template) {
150        SyncInfoBuilder builder = new SyncInfoBuilder();
151        builder.channel = template.getChannel();
152        builder.externalId = template.getExternalId();
153        builder.syncedAt = template.getSyncedAt();
154        return builder;
155    }
156
157}