001
002package com.commercetools.ml.models.general_category_recommendations;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * GeneralCategoryRecommendationBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     GeneralCategoryRecommendation generalCategoryRecommendation = GeneralCategoryRecommendation.builder()
016 *             .categoryName("{categoryName}")
017 *             .confidence(0.3)
018 *             .build()
019 * </code></pre>
020 * </div>
021 */
022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
023public class GeneralCategoryRecommendationBuilder implements Builder<GeneralCategoryRecommendation> {
024
025    private String categoryName;
026
027    private Double confidence;
028
029    /**
030     *  <p>An English category name that is recommended for a product.</p>
031     */
032
033    public GeneralCategoryRecommendationBuilder categoryName(final String categoryName) {
034        this.categoryName = categoryName;
035        return this;
036    }
037
038    /**
039     *  <p>Probability score for the category recommendation.</p>
040     */
041
042    public GeneralCategoryRecommendationBuilder confidence(final Double confidence) {
043        this.confidence = confidence;
044        return this;
045    }
046
047    public String getCategoryName() {
048        return this.categoryName;
049    }
050
051    public Double getConfidence() {
052        return this.confidence;
053    }
054
055    public GeneralCategoryRecommendation build() {
056        Objects.requireNonNull(categoryName, GeneralCategoryRecommendation.class + ": categoryName is missing");
057        Objects.requireNonNull(confidence, GeneralCategoryRecommendation.class + ": confidence is missing");
058        return new GeneralCategoryRecommendationImpl(categoryName, confidence);
059    }
060
061    /**
062     * builds GeneralCategoryRecommendation without checking for non null required values
063     */
064    public GeneralCategoryRecommendation buildUnchecked() {
065        return new GeneralCategoryRecommendationImpl(categoryName, confidence);
066    }
067
068    public static GeneralCategoryRecommendationBuilder of() {
069        return new GeneralCategoryRecommendationBuilder();
070    }
071
072    public static GeneralCategoryRecommendationBuilder of(final GeneralCategoryRecommendation template) {
073        GeneralCategoryRecommendationBuilder builder = new GeneralCategoryRecommendationBuilder();
074        builder.categoryName = template.getCategoryName();
075        builder.confidence = template.getConfidence();
076        return builder;
077    }
078
079}