001
002package com.commercetools.ml.models.similar_products;
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 * SimilarProductBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     SimilarProduct similarProduct = SimilarProduct.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 SimilarProductBuilder implements Builder<SimilarProduct> {
025
026    @Nullable
027    private com.commercetools.ml.models.common.ProductReference product;
028
029    @Nullable
030    private Long variantId;
031
032    @Nullable
033    private com.commercetools.ml.models.similar_products.SimilarProductMeta meta;
034
035    /**
036     *  <p>Reference to Product</p>
037     * @param builder function to build the product value
038     * @return Builder
039     */
040
041    public SimilarProductBuilder product(
042            Function<com.commercetools.ml.models.common.ProductReferenceBuilder, com.commercetools.ml.models.common.ProductReferenceBuilder> builder) {
043        this.product = builder.apply(com.commercetools.ml.models.common.ProductReferenceBuilder.of()).build();
044        return this;
045    }
046
047    /**
048     *  <p>Reference to Product</p>
049     * @param builder function to build the product value
050     * @return Builder
051     */
052
053    public SimilarProductBuilder withProduct(
054            Function<com.commercetools.ml.models.common.ProductReferenceBuilder, com.commercetools.ml.models.common.ProductReference> builder) {
055        this.product = builder.apply(com.commercetools.ml.models.common.ProductReferenceBuilder.of());
056        return this;
057    }
058
059    /**
060     *  <p>Reference to Product</p>
061     * @param product value to be set
062     * @return Builder
063     */
064
065    public SimilarProductBuilder product(@Nullable final com.commercetools.ml.models.common.ProductReference product) {
066        this.product = product;
067        return this;
068    }
069
070    /**
071     *  <p>ID of the ProductVariant that was compared.</p>
072     * @param variantId value to be set
073     * @return Builder
074     */
075
076    public SimilarProductBuilder variantId(@Nullable final Long variantId) {
077        this.variantId = variantId;
078        return this;
079    }
080
081    /**
082     *  <p>Supplementary information about the data used for similarity estimation. This information helps you understand the estimated confidence score, but it should not be used to identify a product.</p>
083     * @param builder function to build the meta value
084     * @return Builder
085     */
086
087    public SimilarProductBuilder meta(
088            Function<com.commercetools.ml.models.similar_products.SimilarProductMetaBuilder, com.commercetools.ml.models.similar_products.SimilarProductMetaBuilder> builder) {
089        this.meta = builder.apply(com.commercetools.ml.models.similar_products.SimilarProductMetaBuilder.of()).build();
090        return this;
091    }
092
093    /**
094     *  <p>Supplementary information about the data used for similarity estimation. This information helps you understand the estimated confidence score, but it should not be used to identify a product.</p>
095     * @param builder function to build the meta value
096     * @return Builder
097     */
098
099    public SimilarProductBuilder withMeta(
100            Function<com.commercetools.ml.models.similar_products.SimilarProductMetaBuilder, com.commercetools.ml.models.similar_products.SimilarProductMeta> builder) {
101        this.meta = builder.apply(com.commercetools.ml.models.similar_products.SimilarProductMetaBuilder.of());
102        return this;
103    }
104
105    /**
106     *  <p>Supplementary information about the data used for similarity estimation. This information helps you understand the estimated confidence score, but it should not be used to identify a product.</p>
107     * @param meta value to be set
108     * @return Builder
109     */
110
111    public SimilarProductBuilder meta(
112            @Nullable final com.commercetools.ml.models.similar_products.SimilarProductMeta meta) {
113        this.meta = meta;
114        return this;
115    }
116
117    /**
118     *  <p>Reference to Product</p>
119     * @return product
120     */
121
122    @Nullable
123    public com.commercetools.ml.models.common.ProductReference getProduct() {
124        return this.product;
125    }
126
127    /**
128     *  <p>ID of the ProductVariant that was compared.</p>
129     * @return variantId
130     */
131
132    @Nullable
133    public Long getVariantId() {
134        return this.variantId;
135    }
136
137    /**
138     *  <p>Supplementary information about the data used for similarity estimation. This information helps you understand the estimated confidence score, but it should not be used to identify a product.</p>
139     * @return meta
140     */
141
142    @Nullable
143    public com.commercetools.ml.models.similar_products.SimilarProductMeta getMeta() {
144        return this.meta;
145    }
146
147    /**
148     * builds SimilarProduct with checking for non-null required values
149     * @return SimilarProduct
150     */
151    public SimilarProduct build() {
152        return new SimilarProductImpl(product, variantId, meta);
153    }
154
155    /**
156     * builds SimilarProduct without checking for non-null required values
157     * @return SimilarProduct
158     */
159    public SimilarProduct buildUnchecked() {
160        return new SimilarProductImpl(product, variantId, meta);
161    }
162
163    /**
164     * factory method for an instance of SimilarProductBuilder
165     * @return builder
166     */
167    public static SimilarProductBuilder of() {
168        return new SimilarProductBuilder();
169    }
170
171    /**
172     * create builder for SimilarProduct instance
173     * @param template instance with prefilled values for the builder
174     * @return builder
175     */
176    public static SimilarProductBuilder of(final SimilarProduct template) {
177        SimilarProductBuilder builder = new SimilarProductBuilder();
178        builder.product = template.getProduct();
179        builder.variantId = template.getVariantId();
180        builder.meta = template.getMeta();
181        return builder;
182    }
183
184}