001
002package com.commercetools.history.models.common;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * ReviewRatingStatisticsBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     ReviewRatingStatistics reviewRatingStatistics = ReviewRatingStatistics.builder()
016 *             .averageRating(1)
017 *             .highestRating(1)
018 *             .lowestRating(1)
019 *             .count(1)
020 *             .ratingsDistribution(ratingsDistributionBuilder -> ratingsDistributionBuilder)
021 *             .build()
022 * </code></pre>
023 * </div>
024 */
025@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
026public class ReviewRatingStatisticsBuilder implements Builder<ReviewRatingStatistics> {
027
028    private Integer averageRating;
029
030    private Integer highestRating;
031
032    private Integer lowestRating;
033
034    private Integer count;
035
036    private java.lang.Object ratingsDistribution;
037
038    /**
039     *  <p>Average rating of one target This number is rounded with 5 decimals.</p>
040     * @param averageRating value to be set
041     * @return Builder
042     */
043
044    public ReviewRatingStatisticsBuilder averageRating(final Integer averageRating) {
045        this.averageRating = averageRating;
046        return this;
047    }
048
049    /**
050     *  <p>Highest rating of one target</p>
051     * @param highestRating value to be set
052     * @return Builder
053     */
054
055    public ReviewRatingStatisticsBuilder highestRating(final Integer highestRating) {
056        this.highestRating = highestRating;
057        return this;
058    }
059
060    /**
061     *  <p>Lowest rating of one target</p>
062     * @param lowestRating value to be set
063     * @return Builder
064     */
065
066    public ReviewRatingStatisticsBuilder lowestRating(final Integer lowestRating) {
067        this.lowestRating = lowestRating;
068        return this;
069    }
070
071    /**
072     *  <p>Number of ratings taken into account</p>
073     * @param count value to be set
074     * @return Builder
075     */
076
077    public ReviewRatingStatisticsBuilder count(final Integer count) {
078        this.count = count;
079        return this;
080    }
081
082    /**
083     *  <p>The full distribution of the ratings. The keys are the different ratings and the values are the count of reviews having this rating. Only the used ratings appear in this object.</p>
084     * @param ratingsDistribution value to be set
085     * @return Builder
086     */
087
088    public ReviewRatingStatisticsBuilder ratingsDistribution(final java.lang.Object ratingsDistribution) {
089        this.ratingsDistribution = ratingsDistribution;
090        return this;
091    }
092
093    /**
094     *  <p>Average rating of one target This number is rounded with 5 decimals.</p>
095     * @return averageRating
096     */
097
098    public Integer getAverageRating() {
099        return this.averageRating;
100    }
101
102    /**
103     *  <p>Highest rating of one target</p>
104     * @return highestRating
105     */
106
107    public Integer getHighestRating() {
108        return this.highestRating;
109    }
110
111    /**
112     *  <p>Lowest rating of one target</p>
113     * @return lowestRating
114     */
115
116    public Integer getLowestRating() {
117        return this.lowestRating;
118    }
119
120    /**
121     *  <p>Number of ratings taken into account</p>
122     * @return count
123     */
124
125    public Integer getCount() {
126        return this.count;
127    }
128
129    /**
130     *  <p>The full distribution of the ratings. The keys are the different ratings and the values are the count of reviews having this rating. Only the used ratings appear in this object.</p>
131     * @return ratingsDistribution
132     */
133
134    public java.lang.Object getRatingsDistribution() {
135        return this.ratingsDistribution;
136    }
137
138    /**
139     * builds ReviewRatingStatistics with checking for non-null required values
140     * @return ReviewRatingStatistics
141     */
142    public ReviewRatingStatistics build() {
143        Objects.requireNonNull(averageRating, ReviewRatingStatistics.class + ": averageRating is missing");
144        Objects.requireNonNull(highestRating, ReviewRatingStatistics.class + ": highestRating is missing");
145        Objects.requireNonNull(lowestRating, ReviewRatingStatistics.class + ": lowestRating is missing");
146        Objects.requireNonNull(count, ReviewRatingStatistics.class + ": count is missing");
147        Objects.requireNonNull(ratingsDistribution, ReviewRatingStatistics.class + ": ratingsDistribution is missing");
148        return new ReviewRatingStatisticsImpl(averageRating, highestRating, lowestRating, count, ratingsDistribution);
149    }
150
151    /**
152     * builds ReviewRatingStatistics without checking for non-null required values
153     * @return ReviewRatingStatistics
154     */
155    public ReviewRatingStatistics buildUnchecked() {
156        return new ReviewRatingStatisticsImpl(averageRating, highestRating, lowestRating, count, ratingsDistribution);
157    }
158
159    /**
160     * factory method for an instance of ReviewRatingStatisticsBuilder
161     * @return builder
162     */
163    public static ReviewRatingStatisticsBuilder of() {
164        return new ReviewRatingStatisticsBuilder();
165    }
166
167    /**
168     * create builder for ReviewRatingStatistics instance
169     * @param template instance with prefilled values for the builder
170     * @return builder
171     */
172    public static ReviewRatingStatisticsBuilder of(final ReviewRatingStatistics template) {
173        ReviewRatingStatisticsBuilder builder = new ReviewRatingStatisticsBuilder();
174        builder.averageRating = template.getAverageRating();
175        builder.highestRating = template.getHighestRating();
176        builder.lowestRating = template.getLowestRating();
177        builder.count = template.getCount();
178        builder.ratingsDistribution = template.getRatingsDistribution();
179        return builder;
180    }
181
182}