Class MetricRule.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderType>
com.google.protobuf.GeneratedMessageV3.Builder<MetricRule.Builder>
com.google.api.MetricRule.Builder
All Implemented Interfaces:
MetricRuleOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
Enclosing class:
MetricRule

public static final class MetricRule.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<MetricRule.Builder> implements MetricRuleOrBuilder
 Bind API methods to metrics. Binding a method to a metric causes that
 metric's configured quota behaviors to apply to the method call.
 
Protobuf type google.api.MetricRule
  • Method Details

    • getDescriptor

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

      protected com.google.protobuf.MapField internalGetMapField(int number)
      Overrides:
      internalGetMapField in class com.google.protobuf.GeneratedMessageV3.Builder<MetricRule.Builder>
    • internalGetMutableMapField

      protected com.google.protobuf.MapField internalGetMutableMapField(int number)
      Overrides:
      internalGetMutableMapField in class com.google.protobuf.GeneratedMessageV3.Builder<MetricRule.Builder>
    • internalGetFieldAccessorTable

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

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

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

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

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

      public MetricRule.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<MetricRule.Builder>
    • setField

      public MetricRule.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<MetricRule.Builder>
    • clearField

      public MetricRule.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<MetricRule.Builder>
    • clearOneof

      public MetricRule.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<MetricRule.Builder>
    • setRepeatedField

      public MetricRule.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<MetricRule.Builder>
    • addRepeatedField

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

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

      public MetricRule.Builder mergeFrom(MetricRule other)
    • isInitialized

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

      public MetricRule.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<MetricRule.Builder>
      Throws:
      IOException
    • getSelector

      public String getSelector()
       Selects the methods to which this rule applies.
       Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
       
      string selector = 1;
      Specified by:
      getSelector in interface MetricRuleOrBuilder
      Returns:
      The selector.
    • getSelectorBytes

      public com.google.protobuf.ByteString getSelectorBytes()
       Selects the methods to which this rule applies.
       Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
       
      string selector = 1;
      Specified by:
      getSelectorBytes in interface MetricRuleOrBuilder
      Returns:
      The bytes for selector.
    • setSelector

      public MetricRule.Builder setSelector(String value)
       Selects the methods to which this rule applies.
       Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
       
      string selector = 1;
      Parameters:
      value - The selector to set.
      Returns:
      This builder for chaining.
    • clearSelector

      public MetricRule.Builder clearSelector()
       Selects the methods to which this rule applies.
       Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
       
      string selector = 1;
      Returns:
      This builder for chaining.
    • setSelectorBytes

      public MetricRule.Builder setSelectorBytes(com.google.protobuf.ByteString value)
       Selects the methods to which this rule applies.
       Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
       
      string selector = 1;
      Parameters:
      value - The bytes for selector to set.
      Returns:
      This builder for chaining.
    • getMetricCostsCount

      public int getMetricCostsCount()
      Description copied from interface: MetricRuleOrBuilder
       Metrics to update when the selected methods are called, and the associated
       cost applied to each metric.
       The key of the map is the metric name, and the values are the amount
       increased for the metric against which the quota limits are defined.
       The value must not be negative.
       
      map<string, int64> metric_costs = 2;
      Specified by:
      getMetricCostsCount in interface MetricRuleOrBuilder
    • containsMetricCosts

      public boolean containsMetricCosts(String key)
       Metrics to update when the selected methods are called, and the associated
       cost applied to each metric.
       The key of the map is the metric name, and the values are the amount
       increased for the metric against which the quota limits are defined.
       The value must not be negative.
       
      map<string, int64> metric_costs = 2;
      Specified by:
      containsMetricCosts in interface MetricRuleOrBuilder
    • getMetricCosts

      @Deprecated public Map<String,Long> getMetricCosts()
      Deprecated.
      Use getMetricCostsMap() instead.
      Specified by:
      getMetricCosts in interface MetricRuleOrBuilder
    • getMetricCostsMap

      public Map<String,Long> getMetricCostsMap()
       Metrics to update when the selected methods are called, and the associated
       cost applied to each metric.
       The key of the map is the metric name, and the values are the amount
       increased for the metric against which the quota limits are defined.
       The value must not be negative.
       
      map<string, int64> metric_costs = 2;
      Specified by:
      getMetricCostsMap in interface MetricRuleOrBuilder
    • getMetricCostsOrDefault

      public long getMetricCostsOrDefault(String key, long defaultValue)
       Metrics to update when the selected methods are called, and the associated
       cost applied to each metric.
       The key of the map is the metric name, and the values are the amount
       increased for the metric against which the quota limits are defined.
       The value must not be negative.
       
      map<string, int64> metric_costs = 2;
      Specified by:
      getMetricCostsOrDefault in interface MetricRuleOrBuilder
    • getMetricCostsOrThrow

      public long getMetricCostsOrThrow(String key)
       Metrics to update when the selected methods are called, and the associated
       cost applied to each metric.
       The key of the map is the metric name, and the values are the amount
       increased for the metric against which the quota limits are defined.
       The value must not be negative.
       
      map<string, int64> metric_costs = 2;
      Specified by:
      getMetricCostsOrThrow in interface MetricRuleOrBuilder
    • clearMetricCosts

      public MetricRule.Builder clearMetricCosts()
    • removeMetricCosts

      public MetricRule.Builder removeMetricCosts(String key)
       Metrics to update when the selected methods are called, and the associated
       cost applied to each metric.
       The key of the map is the metric name, and the values are the amount
       increased for the metric against which the quota limits are defined.
       The value must not be negative.
       
      map<string, int64> metric_costs = 2;
    • getMutableMetricCosts

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

      public MetricRule.Builder putMetricCosts(String key, long value)
       Metrics to update when the selected methods are called, and the associated
       cost applied to each metric.
       The key of the map is the metric name, and the values are the amount
       increased for the metric against which the quota limits are defined.
       The value must not be negative.
       
      map<string, int64> metric_costs = 2;
    • putAllMetricCosts

      public MetricRule.Builder putAllMetricCosts(Map<String,Long> values)
       Metrics to update when the selected methods are called, and the associated
       cost applied to each metric.
       The key of the map is the metric name, and the values are the amount
       increased for the metric against which the quota limits are defined.
       The value must not be negative.
       
      map<string, int64> metric_costs = 2;
    • setUnknownFields

      public final MetricRule.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<MetricRule.Builder>
    • mergeUnknownFields

      public final MetricRule.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<MetricRule.Builder>