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

     ReviewRatingStatistics reviewRatingStatistics = ReviewRatingStatistics.builder()
             .averageRating(0.3)
             .highestRating(0.3)
             .lowestRating(0.3)
             .count(1)
             .ratingsDistribution(ratingsDistributionBuilder -> ratingsDistributionBuilder)
             .build()
 
  • Constructor Details

    • ReviewRatingStatisticsBuilder

      public ReviewRatingStatisticsBuilder()
  • Method Details

    • averageRating

      public ReviewRatingStatisticsBuilder averageRating(Double averageRating)

      Average rating of one target This number is rounded with 5 decimals.

      Parameters:
      averageRating - value to be set
      Returns:
      Builder
    • highestRating

      public ReviewRatingStatisticsBuilder highestRating(Double highestRating)

      Highest rating of one target

      Parameters:
      highestRating - value to be set
      Returns:
      Builder
    • lowestRating

      public ReviewRatingStatisticsBuilder lowestRating(Double lowestRating)

      Lowest rating of one target

      Parameters:
      lowestRating - value to be set
      Returns:
      Builder
    • count

      public ReviewRatingStatisticsBuilder count(Integer count)

      Number of ratings taken into account

      Parameters:
      count - value to be set
      Returns:
      Builder
    • ratingsDistribution

      public ReviewRatingStatisticsBuilder ratingsDistribution(Object 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

      public Double getAverageRating()

      Average rating of one target This number is rounded with 5 decimals.

      Returns:
      averageRating
    • getHighestRating

      public Double getHighestRating()

      Highest rating of one target

      Returns:
      highestRating
    • getLowestRating

      public Double getLowestRating()

      Lowest rating of one target

      Returns:
      lowestRating
    • getCount

      public Integer getCount()

      Number of ratings taken into account

      Returns:
      count
    • getRatingsDistribution

      public Object 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

      public ReviewRatingStatistics build()
      builds ReviewRatingStatistics with checking for non-null required values
      Specified by:
      build in interface Builder<ReviewRatingStatistics>
      Returns:
      ReviewRatingStatistics
    • buildUnchecked

      public ReviewRatingStatistics buildUnchecked()
      builds ReviewRatingStatistics without checking for non-null required values
      Returns:
      ReviewRatingStatistics
    • of

      public static ReviewRatingStatisticsBuilder 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