Class RatingCountAndPercentage

java.lang.Object
com.broadleafcommerce.ratings.domain.RatingCountAndPercentage
All Implemented Interfaces:
Serializable

public class RatingCountAndPercentage extends Object implements Serializable
Represents the count & percentage for each rating of the total ratings for a given product/variant. For example: Total: five ratings with two 2-star ratings, two 3-star ratings, and one 5-star rating An RatingCountAndPercentage object could be created to represent each rating's data like so: 1-star: rating = 1; ratingCount = 0; ratingPercentage = 0% 2-star: rating = 2; ratingCount = 2; ratingPercentage = 40% 3-star: rating = 3; ratingCount = 2; ratingPercentage = 40% 4-star: rating = 4; ratingCount = 0; ratingPercentage = 0% 5-star: rating = 5; ratingCount = 1; ratingPercentage = 20%
Author:
Julia Lopez-Pozas (julial)
See Also:
  • Constructor Details

    • RatingCountAndPercentage

      public RatingCountAndPercentage()
  • Method Details

    • getRating

      public int getRating()
      The rating value that we are counting.
    • getRatingCount

      public int getRatingCount()
      The total count of the rating value.
    • getRatingPercentage

      public double getRatingPercentage()
      The occurrence of this rating value from the total amount of ratings, displayed as a percentage formatted with 2 decimal places.
    • setRating

      public void setRating(int rating)
      The rating value that we are counting.
    • setRatingCount

      public void setRatingCount(int ratingCount)
      The total count of the rating value.
    • setRatingPercentage

      public void setRatingPercentage(double ratingPercentage)
      The occurrence of this rating value from the total amount of ratings, displayed as a percentage formatted with 2 decimal places.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object