com.commercetools.history.models.common.ReviewRatingStatisticsBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commercetools-sdk-java-history Show documentation
Show all versions of commercetools-sdk-java-history Show documentation
The e-commerce SDK from commercetools Composable Commerce for Java
package com.commercetools.history.models.common;
import java.util.*;
import io.vrap.rmf.base.client.Builder;
import io.vrap.rmf.base.client.utils.Generated;
/**
* 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()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ReviewRatingStatisticsBuilder implements Builder {
private Integer averageRating;
private Integer highestRating;
private Integer lowestRating;
private Integer count;
private java.lang.Object ratingsDistribution;
/**
* Average rating of one target This number is rounded with 5 decimals.
* @param averageRating value to be set
* @return Builder
*/
public ReviewRatingStatisticsBuilder averageRating(final Integer averageRating) {
this.averageRating = averageRating;
return this;
}
/**
* Highest rating of one target
* @param highestRating value to be set
* @return Builder
*/
public ReviewRatingStatisticsBuilder highestRating(final Integer highestRating) {
this.highestRating = highestRating;
return this;
}
/**
* Lowest rating of one target
* @param lowestRating value to be set
* @return Builder
*/
public ReviewRatingStatisticsBuilder lowestRating(final Integer lowestRating) {
this.lowestRating = lowestRating;
return this;
}
/**
* Number of ratings taken into account
* @param count value to be set
* @return Builder
*/
public ReviewRatingStatisticsBuilder count(final Integer count) {
this.count = count;
return this;
}
/**
* 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.
* @param ratingsDistribution value to be set
* @return Builder
*/
public ReviewRatingStatisticsBuilder ratingsDistribution(final java.lang.Object ratingsDistribution) {
this.ratingsDistribution = ratingsDistribution;
return this;
}
/**
* Average rating of one target This number is rounded with 5 decimals.
* @return averageRating
*/
public Integer getAverageRating() {
return this.averageRating;
}
/**
* Highest rating of one target
* @return highestRating
*/
public Integer getHighestRating() {
return this.highestRating;
}
/**
* Lowest rating of one target
* @return lowestRating
*/
public Integer getLowestRating() {
return this.lowestRating;
}
/**
* Number of ratings taken into account
* @return count
*/
public Integer getCount() {
return this.count;
}
/**
* 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.
* @return ratingsDistribution
*/
public java.lang.Object getRatingsDistribution() {
return this.ratingsDistribution;
}
/**
* builds ReviewRatingStatistics with checking for non-null required values
* @return ReviewRatingStatistics
*/
public ReviewRatingStatistics build() {
Objects.requireNonNull(averageRating, ReviewRatingStatistics.class + ": averageRating is missing");
Objects.requireNonNull(highestRating, ReviewRatingStatistics.class + ": highestRating is missing");
Objects.requireNonNull(lowestRating, ReviewRatingStatistics.class + ": lowestRating is missing");
Objects.requireNonNull(count, ReviewRatingStatistics.class + ": count is missing");
Objects.requireNonNull(ratingsDistribution, ReviewRatingStatistics.class + ": ratingsDistribution is missing");
return new ReviewRatingStatisticsImpl(averageRating, highestRating, lowestRating, count, ratingsDistribution);
}
/**
* builds ReviewRatingStatistics without checking for non-null required values
* @return ReviewRatingStatistics
*/
public ReviewRatingStatistics buildUnchecked() {
return new ReviewRatingStatisticsImpl(averageRating, highestRating, lowestRating, count, ratingsDistribution);
}
/**
* factory method for an instance of ReviewRatingStatisticsBuilder
* @return builder
*/
public static ReviewRatingStatisticsBuilder of() {
return new ReviewRatingStatisticsBuilder();
}
/**
* create builder for ReviewRatingStatistics instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static ReviewRatingStatisticsBuilder of(final ReviewRatingStatistics template) {
ReviewRatingStatisticsBuilder builder = new ReviewRatingStatisticsBuilder();
builder.averageRating = template.getAverageRating();
builder.highestRating = template.getHighestRating();
builder.lowestRating = template.getLowestRating();
builder.count = template.getCount();
builder.ratingsDistribution = template.getRatingsDistribution();
return builder;
}
}