Class 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.GeneratedMessageV3.Builder<Rating.Builder>
    implements RatingOrBuilder
     The rating of a [Product][google.cloud.retail.v2.Product].
     
    Protobuf type google.cloud.retail.v2.Rating
    • Method Detail

      • getDescriptor

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

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.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.GeneratedMessageV3.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.GeneratedMessageV3.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
      • clone

        public Rating.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<Rating.Builder>
      • setField

        public Rating.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                       Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<Rating.Builder>
      • clearField

        public Rating.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<Rating.Builder>
      • clearOneof

        public Rating.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<Rating.Builder>
      • setRepeatedField

        public Rating.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                               int index,
                                               Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Rating.Builder>
      • addRepeatedField

        public Rating.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                               Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Rating.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>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.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.v2.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.v2.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.v2.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.v2.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.v2.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.v2.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.v2.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.v2.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.v2.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.v2.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.v2.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.v2.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.v2.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.
      • setUnknownFields

        public final Rating.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Rating.Builder>
      • mergeUnknownFields

        public final Rating.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Rating.Builder>