001 002package com.commercetools.history.models.common; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.Valid; 010import javax.validation.constraints.NotNull; 011 012import com.fasterxml.jackson.annotation.*; 013import com.fasterxml.jackson.databind.annotation.*; 014 015import io.vrap.rmf.base.client.utils.Generated; 016 017/** 018 * ReviewRatingStatistics 019 * 020 * <hr> 021 * Example to create an instance using the builder pattern 022 * <div class=code-example> 023 * <pre><code class='java'> 024 * ReviewRatingStatistics reviewRatingStatistics = ReviewRatingStatistics.builder() 025 * .averageRating(1) 026 * .highestRating(1) 027 * .lowestRating(1) 028 * .count(1) 029 * .ratingsDistribution(ratingsDistributionBuilder -> ratingsDistributionBuilder) 030 * .build() 031 * </code></pre> 032 * </div> 033 */ 034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 035@JsonDeserialize(as = ReviewRatingStatisticsImpl.class) 036public interface ReviewRatingStatistics { 037 038 /** 039 * <p>Average rating of one target This number is rounded with 5 decimals.</p> 040 * @return averageRating 041 */ 042 @NotNull 043 @JsonProperty("averageRating") 044 public Integer getAverageRating(); 045 046 /** 047 * <p>Highest rating of one target</p> 048 * @return highestRating 049 */ 050 @NotNull 051 @JsonProperty("highestRating") 052 public Integer getHighestRating(); 053 054 /** 055 * <p>Lowest rating of one target</p> 056 * @return lowestRating 057 */ 058 @NotNull 059 @JsonProperty("lowestRating") 060 public Integer getLowestRating(); 061 062 /** 063 * <p>Number of ratings taken into account</p> 064 * @return count 065 */ 066 @NotNull 067 @JsonProperty("count") 068 public Integer getCount(); 069 070 /** 071 * <p>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.</p> 072 * @return ratingsDistribution 073 */ 074 @NotNull 075 @Valid 076 @JsonProperty("ratingsDistribution") 077 public Object getRatingsDistribution(); 078 079 /** 080 * <p>Average rating of one target This number is rounded with 5 decimals.</p> 081 * @param averageRating value to be set 082 */ 083 084 public void setAverageRating(final Integer averageRating); 085 086 /** 087 * <p>Highest rating of one target</p> 088 * @param highestRating value to be set 089 */ 090 091 public void setHighestRating(final Integer highestRating); 092 093 /** 094 * <p>Lowest rating of one target</p> 095 * @param lowestRating value to be set 096 */ 097 098 public void setLowestRating(final Integer lowestRating); 099 100 /** 101 * <p>Number of ratings taken into account</p> 102 * @param count value to be set 103 */ 104 105 public void setCount(final Integer count); 106 107 /** 108 * <p>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.</p> 109 * @param ratingsDistribution value to be set 110 */ 111 112 public void setRatingsDistribution(final Object ratingsDistribution); 113 114 /** 115 * factory method 116 * @return instance of ReviewRatingStatistics 117 */ 118 public static ReviewRatingStatistics of() { 119 return new ReviewRatingStatisticsImpl(); 120 } 121 122 /** 123 * factory method to create a shallow copy ReviewRatingStatistics 124 * @param template instance to be copied 125 * @return copy instance 126 */ 127 public static ReviewRatingStatistics of(final ReviewRatingStatistics template) { 128 ReviewRatingStatisticsImpl instance = new ReviewRatingStatisticsImpl(); 129 instance.setAverageRating(template.getAverageRating()); 130 instance.setHighestRating(template.getHighestRating()); 131 instance.setLowestRating(template.getLowestRating()); 132 instance.setCount(template.getCount()); 133 instance.setRatingsDistribution(template.getRatingsDistribution()); 134 return instance; 135 } 136 137 /** 138 * factory method to create a deep copy of ReviewRatingStatistics 139 * @param template instance to be copied 140 * @return copy instance 141 */ 142 @Nullable 143 public static ReviewRatingStatistics deepCopy(@Nullable final ReviewRatingStatistics template) { 144 if (template == null) { 145 return null; 146 } 147 ReviewRatingStatisticsImpl instance = new ReviewRatingStatisticsImpl(); 148 instance.setAverageRating(template.getAverageRating()); 149 instance.setHighestRating(template.getHighestRating()); 150 instance.setLowestRating(template.getLowestRating()); 151 instance.setCount(template.getCount()); 152 instance.setRatingsDistribution(template.getRatingsDistribution()); 153 return instance; 154 } 155 156 /** 157 * builder factory method for ReviewRatingStatistics 158 * @return builder 159 */ 160 public static ReviewRatingStatisticsBuilder builder() { 161 return ReviewRatingStatisticsBuilder.of(); 162 } 163 164 /** 165 * create builder for ReviewRatingStatistics instance 166 * @param template instance with prefilled values for the builder 167 * @return builder 168 */ 169 public static ReviewRatingStatisticsBuilder builder(final ReviewRatingStatistics template) { 170 return ReviewRatingStatisticsBuilder.of(template); 171 } 172 173 /** 174 * accessor map function 175 * @param <T> mapped type 176 * @param helper function to map the object 177 * @return mapped value 178 */ 179 default <T> T withReviewRatingStatistics(Function<ReviewRatingStatistics, T> helper) { 180 return helper.apply(this); 181 } 182 183 /** 184 * gives a TypeReference for usage with Jackson DataBind 185 * @return TypeReference 186 */ 187 public static com.fasterxml.jackson.core.type.TypeReference<ReviewRatingStatistics> typeReference() { 188 return new com.fasterxml.jackson.core.type.TypeReference<ReviewRatingStatistics>() { 189 @Override 190 public String toString() { 191 return "TypeReference<ReviewRatingStatistics>"; 192 } 193 }; 194 } 195}