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 * SimilarProductMetaBuilder
014 * <hr>
015 * Example to create an instance using the builder pattern
016 * <div class=code-example>
017 * <pre><code class='java'>
018 *     SimilarProductMeta similarProductMeta = SimilarProductMeta.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 SimilarProductMetaBuilder implements Builder<SimilarProductMeta> {
025
026    @Nullable
027    private com.commercetools.ml.models.common.LocalizedString name;
028
029    @Nullable
030    private com.commercetools.ml.models.common.LocalizedString description;
031
032    @Nullable
033    private com.commercetools.ml.models.common.Money price;
034
035    @Nullable
036    private Long variantCount;
037
038    /**
039     *  <p>Localized product name used for similarity estimation.</p>
040     */
041
042    public SimilarProductMetaBuilder name(
043            Function<com.commercetools.ml.models.common.LocalizedStringBuilder, com.commercetools.ml.models.common.LocalizedStringBuilder> builder) {
044        this.name = builder.apply(com.commercetools.ml.models.common.LocalizedStringBuilder.of()).build();
045        return this;
046    }
047
048    /**
049     *  <p>Localized product name used for similarity estimation.</p>
050     */
051
052    public SimilarProductMetaBuilder name(@Nullable final com.commercetools.ml.models.common.LocalizedString name) {
053        this.name = name;
054        return this;
055    }
056
057    /**
058     *  <p>Localized product description used for similarity estimation.</p>
059     */
060
061    public SimilarProductMetaBuilder description(
062            Function<com.commercetools.ml.models.common.LocalizedStringBuilder, com.commercetools.ml.models.common.LocalizedStringBuilder> builder) {
063        this.description = builder.apply(com.commercetools.ml.models.common.LocalizedStringBuilder.of()).build();
064        return this;
065    }
066
067    /**
068     *  <p>Localized product description used for similarity estimation.</p>
069     */
070
071    public SimilarProductMetaBuilder description(
072            @Nullable final com.commercetools.ml.models.common.LocalizedString description) {
073        this.description = description;
074        return this;
075    }
076
077    /**
078     *  <p>The product price in cents using the currency defined in SimilarProductSearchRequest If multiple prices exist, the median value is taken as a representative amount.</p>
079     */
080
081    public SimilarProductMetaBuilder price(
082            Function<com.commercetools.ml.models.common.MoneyBuilder, com.commercetools.ml.models.common.MoneyBuilder> builder) {
083        this.price = builder.apply(com.commercetools.ml.models.common.MoneyBuilder.of()).build();
084        return this;
085    }
086
087    /**
088     *  <p>The product price in cents using the currency defined in SimilarProductSearchRequest If multiple prices exist, the median value is taken as a representative amount.</p>
089     */
090
091    public SimilarProductMetaBuilder price(@Nullable final com.commercetools.ml.models.common.Money price) {
092        this.price = price;
093        return this;
094    }
095
096    /**
097     *  <p>Total number of variants associated with the product.</p>
098     */
099
100    public SimilarProductMetaBuilder variantCount(@Nullable final Long variantCount) {
101        this.variantCount = variantCount;
102        return this;
103    }
104
105    @Nullable
106    public com.commercetools.ml.models.common.LocalizedString getName() {
107        return this.name;
108    }
109
110    @Nullable
111    public com.commercetools.ml.models.common.LocalizedString getDescription() {
112        return this.description;
113    }
114
115    @Nullable
116    public com.commercetools.ml.models.common.Money getPrice() {
117        return this.price;
118    }
119
120    @Nullable
121    public Long getVariantCount() {
122        return this.variantCount;
123    }
124
125    public SimilarProductMeta build() {
126        return new SimilarProductMetaImpl(name, description, price, variantCount);
127    }
128
129    /**
130     * builds SimilarProductMeta without checking for non null required values
131     */
132    public SimilarProductMeta buildUnchecked() {
133        return new SimilarProductMetaImpl(name, description, price, variantCount);
134    }
135
136    public static SimilarProductMetaBuilder of() {
137        return new SimilarProductMetaBuilder();
138    }
139
140    public static SimilarProductMetaBuilder of(final SimilarProductMeta template) {
141        SimilarProductMetaBuilder builder = new SimilarProductMetaBuilder();
142        builder.name = template.getName();
143        builder.description = template.getDescription();
144        builder.price = template.getPrice();
145        builder.variantCount = template.getVariantCount();
146        return builder;
147    }
148
149}