Class Rating.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessage.Builder<Rating.Builder>
com.google.cloud.retail.v2alpha.Rating.Builder
All Implemented Interfaces:
RatingOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
Enclosing class:
Rating

public static final class Rating.Builder extends com.google.protobuf.GeneratedMessage.Builder<Rating.Builder> implements RatingOrBuilder
 The rating of a [Product][google.cloud.retail.v2alpha.Product].
 
Protobuf type google.cloud.retail.v2alpha.Rating
  • Method Summary

    Modifier and Type
    Method
    Description
    List of rating counts per rating value (index = rating - 1).
    addRatingHistogram(int value)
    List of rating counts per rating value (index = rating - 1).
     
     
     
    The average rating of the [Product][google.cloud.retail.v2alpha.Product].
    The total number of ratings.
    List of rating counts per rating value (index = rating - 1).
    float
    The average rating of the [Product][google.cloud.retail.v2alpha.Product].
     
    static final com.google.protobuf.Descriptors.Descriptor
     
    com.google.protobuf.Descriptors.Descriptor
     
    int
    The total number of ratings.
    int
    getRatingHistogram(int index)
    List of rating counts per rating value (index = rating - 1).
    int
    List of rating counts per rating value (index = rating - 1).
    List of rating counts per rating value (index = rating - 1).
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
     
    final boolean
     
     
    mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    mergeFrom(com.google.protobuf.Message other)
     
    setAverageRating(float value)
    The average rating of the [Product][google.cloud.retail.v2alpha.Product].
    setRatingCount(int value)
    The total number of ratings.
    setRatingHistogram(int index, int value)
    List of rating counts per rating value (index = rating - 1).

    Methods inherited from class com.google.protobuf.GeneratedMessage.Builder

    addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownFields, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields, setUnknownFieldSetBuilder, setUnknownFieldsProto3

    Methods inherited from class com.google.protobuf.AbstractMessage.Builder

    findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString

    Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder

    addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.protobuf.Message.Builder

    mergeDelimitedFrom, mergeDelimitedFrom

    Methods inherited from interface com.google.protobuf.MessageLite.Builder

    mergeFrom

    Methods inherited from interface com.google.protobuf.MessageOrBuilder

    findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
  • Method Details

    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessage.Builder<Rating.Builder>
    • clear

      public Rating.Builder clear()
      Specified by:
      clear in interface com.google.protobuf.Message.Builder
      Specified by:
      clear in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clear in class com.google.protobuf.GeneratedMessage.Builder<Rating.Builder>
    • getDescriptorForType

      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
      Specified by:
      getDescriptorForType in interface com.google.protobuf.Message.Builder
      Specified by:
      getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
      Overrides:
      getDescriptorForType in class com.google.protobuf.GeneratedMessage.Builder<Rating.Builder>
    • getDefaultInstanceForType

      public Rating getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
    • build

      public Rating build()
      Specified by:
      build in interface com.google.protobuf.Message.Builder
      Specified by:
      build in interface com.google.protobuf.MessageLite.Builder
    • buildPartial

      public Rating buildPartial()
      Specified by:
      buildPartial in interface com.google.protobuf.Message.Builder
      Specified by:
      buildPartial in interface com.google.protobuf.MessageLite.Builder
    • mergeFrom

      public Rating.Builder mergeFrom(com.google.protobuf.Message other)
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<Rating.Builder>
    • mergeFrom

      public Rating.Builder mergeFrom(Rating other)
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessage.Builder<Rating.Builder>
    • mergeFrom

      public Rating.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Specified by:
      mergeFrom in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<Rating.Builder>
      Throws:
      IOException
    • getRatingCount

      public int getRatingCount()
       The total number of ratings. This value is independent of the value of
       [rating_histogram][google.cloud.retail.v2alpha.Rating.rating_histogram].
      
       This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
       returned.
       
      int32 rating_count = 1;
      Specified by:
      getRatingCount in interface RatingOrBuilder
      Returns:
      The ratingCount.
    • setRatingCount

      public Rating.Builder setRatingCount(int value)
       The total number of ratings. This value is independent of the value of
       [rating_histogram][google.cloud.retail.v2alpha.Rating.rating_histogram].
      
       This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
       returned.
       
      int32 rating_count = 1;
      Parameters:
      value - The ratingCount to set.
      Returns:
      This builder for chaining.
    • clearRatingCount

      public Rating.Builder clearRatingCount()
       The total number of ratings. This value is independent of the value of
       [rating_histogram][google.cloud.retail.v2alpha.Rating.rating_histogram].
      
       This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
       returned.
       
      int32 rating_count = 1;
      Returns:
      This builder for chaining.
    • getAverageRating

      public float getAverageRating()
       The average rating of the [Product][google.cloud.retail.v2alpha.Product].
      
       The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
       returned.
       
      float average_rating = 2;
      Specified by:
      getAverageRating in interface RatingOrBuilder
      Returns:
      The averageRating.
    • setAverageRating

      public Rating.Builder setAverageRating(float value)
       The average rating of the [Product][google.cloud.retail.v2alpha.Product].
      
       The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
       returned.
       
      float average_rating = 2;
      Parameters:
      value - The averageRating to set.
      Returns:
      This builder for chaining.
    • clearAverageRating

      public Rating.Builder clearAverageRating()
       The average rating of the [Product][google.cloud.retail.v2alpha.Product].
      
       The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
       returned.
       
      float average_rating = 2;
      Returns:
      This builder for chaining.
    • getRatingHistogramList

      public List<Integer> getRatingHistogramList()
       List of rating counts per rating value (index = rating - 1). The list is
       empty if there is no rating. If the list is non-empty, its size is
       always 5. Otherwise, an INVALID_ARGUMENT error is returned.
      
       For example, [41, 14, 13, 47, 303]. It means that the
       [Product][google.cloud.retail.v2alpha.Product] got 41 ratings with 1 star,
       14 ratings with 2 star, and so on.
       
      repeated int32 rating_histogram = 3;
      Specified by:
      getRatingHistogramList in interface RatingOrBuilder
      Returns:
      A list containing the ratingHistogram.
    • getRatingHistogramCount

      public int getRatingHistogramCount()
       List of rating counts per rating value (index = rating - 1). The list is
       empty if there is no rating. If the list is non-empty, its size is
       always 5. Otherwise, an INVALID_ARGUMENT error is returned.
      
       For example, [41, 14, 13, 47, 303]. It means that the
       [Product][google.cloud.retail.v2alpha.Product] got 41 ratings with 1 star,
       14 ratings with 2 star, and so on.
       
      repeated int32 rating_histogram = 3;
      Specified by:
      getRatingHistogramCount in interface RatingOrBuilder
      Returns:
      The count of ratingHistogram.
    • getRatingHistogram

      public int getRatingHistogram(int index)
       List of rating counts per rating value (index = rating - 1). The list is
       empty if there is no rating. If the list is non-empty, its size is
       always 5. Otherwise, an INVALID_ARGUMENT error is returned.
      
       For example, [41, 14, 13, 47, 303]. It means that the
       [Product][google.cloud.retail.v2alpha.Product] got 41 ratings with 1 star,
       14 ratings with 2 star, and so on.
       
      repeated int32 rating_histogram = 3;
      Specified by:
      getRatingHistogram in interface RatingOrBuilder
      Parameters:
      index - The index of the element to return.
      Returns:
      The ratingHistogram at the given index.
    • setRatingHistogram

      public Rating.Builder setRatingHistogram(int index, int value)
       List of rating counts per rating value (index = rating - 1). The list is
       empty if there is no rating. If the list is non-empty, its size is
       always 5. Otherwise, an INVALID_ARGUMENT error is returned.
      
       For example, [41, 14, 13, 47, 303]. It means that the
       [Product][google.cloud.retail.v2alpha.Product] got 41 ratings with 1 star,
       14 ratings with 2 star, and so on.
       
      repeated int32 rating_histogram = 3;
      Parameters:
      index - The index to set the value at.
      value - The ratingHistogram to set.
      Returns:
      This builder for chaining.
    • addRatingHistogram

      public Rating.Builder addRatingHistogram(int value)
       List of rating counts per rating value (index = rating - 1). The list is
       empty if there is no rating. If the list is non-empty, its size is
       always 5. Otherwise, an INVALID_ARGUMENT error is returned.
      
       For example, [41, 14, 13, 47, 303]. It means that the
       [Product][google.cloud.retail.v2alpha.Product] got 41 ratings with 1 star,
       14 ratings with 2 star, and so on.
       
      repeated int32 rating_histogram = 3;
      Parameters:
      value - The ratingHistogram to add.
      Returns:
      This builder for chaining.
    • addAllRatingHistogram

      public Rating.Builder addAllRatingHistogram(Iterable<? extends Integer> values)
       List of rating counts per rating value (index = rating - 1). The list is
       empty if there is no rating. If the list is non-empty, its size is
       always 5. Otherwise, an INVALID_ARGUMENT error is returned.
      
       For example, [41, 14, 13, 47, 303]. It means that the
       [Product][google.cloud.retail.v2alpha.Product] got 41 ratings with 1 star,
       14 ratings with 2 star, and so on.
       
      repeated int32 rating_histogram = 3;
      Parameters:
      values - The ratingHistogram to add.
      Returns:
      This builder for chaining.
    • clearRatingHistogram

      public Rating.Builder clearRatingHistogram()
       List of rating counts per rating value (index = rating - 1). The list is
       empty if there is no rating. If the list is non-empty, its size is
       always 5. Otherwise, an INVALID_ARGUMENT error is returned.
      
       For example, [41, 14, 13, 47, 303]. It means that the
       [Product][google.cloud.retail.v2alpha.Product] got 41 ratings with 1 star,
       14 ratings with 2 star, and so on.
       
      repeated int32 rating_histogram = 3;
      Returns:
      This builder for chaining.