Class ReviewRatingStatisticsBuilder
java.lang.Object
com.commercetools.history.models.common.ReviewRatingStatisticsBuilder
- All Implemented Interfaces:
Builder<ReviewRatingStatistics>
public class ReviewRatingStatisticsBuilder
extends Object
implements Builder<ReviewRatingStatistics>
ReviewRatingStatisticsBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
ReviewRatingStatistics reviewRatingStatistics = ReviewRatingStatistics.builder()
.averageRating(1)
.highestRating(1)
.lowestRating(1)
.count(1)
.ratingsDistribution(ratingsDistributionBuilder -> ratingsDistributionBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaverageRating
(Integer averageRating) Average rating of one target This number is rounded with 5 decimals.build()
builds ReviewRatingStatistics with checking for non-null required valuesbuilds ReviewRatingStatistics without checking for non-null required valuesNumber of ratings taken into accountAverage rating of one target This number is rounded with 5 decimals.getCount()
Number of ratings taken into accountHighest rating of one targetLowest rating of one targetThe full distribution of the ratings.highestRating
(Integer highestRating) Highest rating of one targetlowestRating
(Integer lowestRating) Lowest rating of one targetof()
factory method for an instance of ReviewRatingStatisticsBuilderof
(ReviewRatingStatistics template) create builder for ReviewRatingStatistics instanceratingsDistribution
(Object ratingsDistribution) The full distribution of the ratings.
-
Constructor Details
-
ReviewRatingStatisticsBuilder
public ReviewRatingStatisticsBuilder()
-
-
Method Details
-
averageRating
Average rating of one target This number is rounded with 5 decimals.
- Parameters:
averageRating
- value to be set- Returns:
- Builder
-
highestRating
Highest rating of one target
- Parameters:
highestRating
- value to be set- Returns:
- Builder
-
lowestRating
Lowest rating of one target
- Parameters:
lowestRating
- value to be set- Returns:
- Builder
-
count
Number of ratings taken into account
- Parameters:
count
- value to be set- Returns:
- Builder
-
ratingsDistribution
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.
- Parameters:
ratingsDistribution
- value to be set- Returns:
- Builder
-
getAverageRating
Average rating of one target This number is rounded with 5 decimals.
- Returns:
- averageRating
-
getHighestRating
Highest rating of one target
- Returns:
- highestRating
-
getLowestRating
Lowest rating of one target
- Returns:
- lowestRating
-
getCount
Number of ratings taken into account
- Returns:
- count
-
getRatingsDistribution
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.
- Returns:
- ratingsDistribution
-
build
builds ReviewRatingStatistics with checking for non-null required values- Specified by:
build
in interfaceBuilder<ReviewRatingStatistics>
- Returns:
- ReviewRatingStatistics
-
buildUnchecked
builds ReviewRatingStatistics without checking for non-null required values- Returns:
- ReviewRatingStatistics
-
of
factory method for an instance of ReviewRatingStatisticsBuilder- Returns:
- builder
-
of
create builder for ReviewRatingStatistics instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-