Class RatingCountAndPercentage
java.lang.Object
com.broadleafcommerce.ratings.domain.RatingCountAndPercentage
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
int
The rating value that we are counting.int
The total count of the rating value.double
The occurrence of this rating value from the total amount of ratings, displayed as a percentage formatted with 2 decimal places.int
hashCode()
void
setRating
(int rating) The rating value that we are counting.void
setRatingCount
(int ratingCount) The total count of the rating value.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.toString()
-
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
-
canEqual
-
hashCode
public int hashCode() -
toString
-