Class ReviewRatingStatisticsBuilder
java.lang.Object
com.commercetools.api.models.review.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(0.3)
.highestRating(0.3)
.lowestRating(0.3)
.count(1)
.ratingsDistribution(ratingsDistributionBuilder -> ratingsDistributionBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaverageRating
(Double 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 targetFull distribution of the ratings.highestRating
(Double highestRating) Highest rating of one targetlowestRating
(Double lowestRating) Lowest rating of one targetof()
factory method for an instance of ReviewRatingStatisticsBuilderof
(ReviewRatingStatistics template) create builder for ReviewRatingStatistics instanceratingsDistribution
(Object ratingsDistribution) 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
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
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
-