Class Rule.PinAction.Builder

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

public static final class Rule.PinAction.Builder extends com.google.protobuf.GeneratedMessage.Builder<Rule.PinAction.Builder> implements Rule.PinActionOrBuilder
 Pins one or more specified products to a specific position in the
 results.

 * Rule Condition:
 Must specify non-empty
 [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms]
 (for search only) or
 [Condition.page_categories][google.cloud.retail.v2alpha.Condition.page_categories]
 (for browse only), but can't specify both.

 * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
 uses 1-based indexing).

 * Action Result: Will pin products with matching ids to the position
 specified in the final result order.

 Example: Suppose the query is `shoes`, the
 [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms]
 is `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will
 be pinned to the top position in the final results.

 If multiple PinActions are matched to a single request the actions will
 be processed from most to least recently updated.

 Pins to positions larger than the max allowed page size of 120 are not
 allowed.
 
Protobuf type google.cloud.retail.v2alpha.Rule.PinAction
  • Method Details

    • getDescriptor

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

      protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
      Overrides:
      internalGetMapFieldReflection in class com.google.protobuf.GeneratedMessage.Builder<Rule.PinAction.Builder>
    • internalGetMutableMapFieldReflection

      protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number)
      Overrides:
      internalGetMutableMapFieldReflection in class com.google.protobuf.GeneratedMessage.Builder<Rule.PinAction.Builder>
    • internalGetFieldAccessorTable

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

      public Rule.PinAction.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<Rule.PinAction.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<Rule.PinAction.Builder>
    • getDefaultInstanceForType

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

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

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

      public Rule.PinAction.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<Rule.PinAction.Builder>
    • mergeFrom

      public Rule.PinAction.Builder mergeFrom(Rule.PinAction other)
    • isInitialized

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

      public Rule.PinAction.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<Rule.PinAction.Builder>
      Throws:
      IOException
    • getPinMapCount

      public int getPinMapCount()
      Description copied from interface: Rule.PinActionOrBuilder
       Required. A map of positions to product_ids.
      
       Partial matches per action are allowed, if a certain position in the map
       is already filled that `[position, product_id]` pair will be ignored
       but the rest may still be applied. This case will only occur if multiple
       pin actions are matched to a single request, as the map guarantees that
       pin positions are unique within the same action.
      
       Duplicate product_ids are not permitted within a single pin map.
      
       The max size of this map is 120, equivalent to the max [request page
       size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
       
      map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getPinMapCount in interface Rule.PinActionOrBuilder
    • containsPinMap

      public boolean containsPinMap(long key)
       Required. A map of positions to product_ids.
      
       Partial matches per action are allowed, if a certain position in the map
       is already filled that `[position, product_id]` pair will be ignored
       but the rest may still be applied. This case will only occur if multiple
       pin actions are matched to a single request, as the map guarantees that
       pin positions are unique within the same action.
      
       Duplicate product_ids are not permitted within a single pin map.
      
       The max size of this map is 120, equivalent to the max [request page
       size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
       
      map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      containsPinMap in interface Rule.PinActionOrBuilder
    • getPinMap

      @Deprecated public Map<Long,String> getPinMap()
      Deprecated.
      Use getPinMapMap() instead.
      Specified by:
      getPinMap in interface Rule.PinActionOrBuilder
    • getPinMapMap

      public Map<Long,String> getPinMapMap()
       Required. A map of positions to product_ids.
      
       Partial matches per action are allowed, if a certain position in the map
       is already filled that `[position, product_id]` pair will be ignored
       but the rest may still be applied. This case will only occur if multiple
       pin actions are matched to a single request, as the map guarantees that
       pin positions are unique within the same action.
      
       Duplicate product_ids are not permitted within a single pin map.
      
       The max size of this map is 120, equivalent to the max [request page
       size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
       
      map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getPinMapMap in interface Rule.PinActionOrBuilder
    • getPinMapOrDefault

      public String getPinMapOrDefault(long key, String defaultValue)
       Required. A map of positions to product_ids.
      
       Partial matches per action are allowed, if a certain position in the map
       is already filled that `[position, product_id]` pair will be ignored
       but the rest may still be applied. This case will only occur if multiple
       pin actions are matched to a single request, as the map guarantees that
       pin positions are unique within the same action.
      
       Duplicate product_ids are not permitted within a single pin map.
      
       The max size of this map is 120, equivalent to the max [request page
       size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
       
      map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getPinMapOrDefault in interface Rule.PinActionOrBuilder
    • getPinMapOrThrow

      public String getPinMapOrThrow(long key)
       Required. A map of positions to product_ids.
      
       Partial matches per action are allowed, if a certain position in the map
       is already filled that `[position, product_id]` pair will be ignored
       but the rest may still be applied. This case will only occur if multiple
       pin actions are matched to a single request, as the map guarantees that
       pin positions are unique within the same action.
      
       Duplicate product_ids are not permitted within a single pin map.
      
       The max size of this map is 120, equivalent to the max [request page
       size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
       
      map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];
      Specified by:
      getPinMapOrThrow in interface Rule.PinActionOrBuilder
    • clearPinMap

      public Rule.PinAction.Builder clearPinMap()
    • removePinMap

      public Rule.PinAction.Builder removePinMap(long key)
       Required. A map of positions to product_ids.
      
       Partial matches per action are allowed, if a certain position in the map
       is already filled that `[position, product_id]` pair will be ignored
       but the rest may still be applied. This case will only occur if multiple
       pin actions are matched to a single request, as the map guarantees that
       pin positions are unique within the same action.
      
       Duplicate product_ids are not permitted within a single pin map.
      
       The max size of this map is 120, equivalent to the max [request page
       size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
       
      map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];
    • getMutablePinMap

      @Deprecated public Map<Long,String> getMutablePinMap()
      Deprecated.
      Use alternate mutation accessors instead.
    • putPinMap

      public Rule.PinAction.Builder putPinMap(long key, String value)
       Required. A map of positions to product_ids.
      
       Partial matches per action are allowed, if a certain position in the map
       is already filled that `[position, product_id]` pair will be ignored
       but the rest may still be applied. This case will only occur if multiple
       pin actions are matched to a single request, as the map guarantees that
       pin positions are unique within the same action.
      
       Duplicate product_ids are not permitted within a single pin map.
      
       The max size of this map is 120, equivalent to the max [request page
       size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
       
      map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];
    • putAllPinMap

      public Rule.PinAction.Builder putAllPinMap(Map<Long,String> values)
       Required. A map of positions to product_ids.
      
       Partial matches per action are allowed, if a certain position in the map
       is already filled that `[position, product_id]` pair will be ignored
       but the rest may still be applied. This case will only occur if multiple
       pin actions are matched to a single request, as the map guarantees that
       pin positions are unique within the same action.
      
       Duplicate product_ids are not permitted within a single pin map.
      
       The max size of this map is 120, equivalent to the max [request page
       size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
       
      map<int64, string> pin_map = 1 [(.google.api.field_behavior) = REQUIRED];