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

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

    • ReviewRatingStatisticsBuilder

      public ReviewRatingStatisticsBuilder()
  • Method Details

    • averageRating

      public ReviewRatingStatisticsBuilder averageRating(Integer 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(Integer highestRating)

      Highest rating of one target

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

      public ReviewRatingStatisticsBuilder lowestRating(Integer 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)

      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

      public Integer getAverageRating()

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

      Returns:
      averageRating
    • getHighestRating

      public Integer getHighestRating()

      Highest rating of one target

      Returns:
      highestRating
    • getLowestRating

      public Integer getLowestRating()

      Lowest rating of one target

      Returns:
      lowestRating
    • getCount

      public Integer getCount()

      Number of ratings taken into account

      Returns:
      count
    • getRatingsDistribution

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

      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