com.h3c.sdn.metric

## Class MetricDescriptor.MetricDescriptorBuilder<T extends MetricDescriptor>

- java.lang.Object
- - com.h3c.sdn.metric.MetricDescriptor.MetricDescriptorBuilder<T>

- Type Parameters:
    `T` - specific metric descriptor subtype
  Direct Known Subclasses:
    CounterDescriptor.CounterDescriptorBuilder, GaugeDescriptor.GaugeDescriptorBuilder, HistogramDescriptor.HistogramDescriptorBuilder, MeterDescriptor.MeterDescriptorBuilder, RatioGaugeDescriptor.RatioGaugeDescriptorBuilder, RollingCounterDescriptor.RollingCounterDescriptorBuilder, TimerDescriptor.TimerDescriptorBuilder
  Enclosing class:
    MetricDescriptor

      public abstract static class MetricDescriptor.MetricDescriptorBuilder<T extends MetricDescriptor>
      extends Object

  Metric descriptor builder object, which requires that only arguments that are mandatory for the construction of a `MetricDescriptor` be specified during its own construction. Values may also be specified for the optional arguments needed for a `MetricDescriptor`, but these values are defaulted in the event that no value is specified for them.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `appId`
    `protected String` | `description`
    `protected boolean` | `jmx`
    `protected String` | `name`
    `protected boolean` | `persist`
    `protected String` | `primaryTag`
    `protected String` | `secondaryTag`
    `protected MetricDescriptor.SummaryIntervalMinutes` | `summaryMinutes`
    `protected MetricDescriptor.Type` | `type`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MetricDescriptor.MetricDescriptorBuilder(String name)` Creates a new `MetricDescriptor.MetricDescriptorBuilder` using only the arguments that are required to build a valid `MetricDescriptor`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MetricDescriptor.MetricDescriptorBuilder<T>` | `appId(String toSet)` Sets the application ID to apply to the `MetricDescriptor` that will be built.
    `abstract T` | `build()` Build a `MetricDescriptor` subclass instance.
    `MetricDescriptor.MetricDescriptorBuilder<T>` | `description(String toSet)` Sets the description to apply to the `MetricDescriptor` that will be built.
    `MetricDescriptor.MetricDescriptorBuilder<T>` | `name(String toSet)` Sets the name to apply to the `MetricDescriptor` that will be built.
    `MetricDescriptor.MetricDescriptorBuilder<T>` | `persist(boolean toSet)` Sets the flag that indicates whether the `MetricDescriptor` that will be built is to be persisted.
    `MetricDescriptor.MetricDescriptorBuilder<T>` | `primaryTag(String toSet)` Sets the primary tag (e.g.
    `MetricDescriptor.MetricDescriptorBuilder<T>` | `publishToJmx(boolean toSet)` Sets the flag that indicates whether the `MetricDescriptor` that will be built should be made visible via JMX.
    `MetricDescriptor.MetricDescriptorBuilder<T>` | `secondaryTag(String toSet)` Sets the secondary tag (e.g.
    `MetricDescriptor.MetricDescriptorBuilder<T>` | `summaryMinutes(MetricDescriptor.SummaryIntervalMinutes toSet)` Sets the number of minutes that should elapse between the persistence of summarized values to apply to the `MetricDescriptor` that will be built.
    `MetricDescriptor.MetricDescriptorBuilder<T>` | `type(MetricDescriptor.Type toSet)` Sets the metric type to apply to the `MetricDescriptor` that will be built.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### jmx

          protected boolean jmx

    - #### persist

          protected boolean persist

    - #### appId

          protected String appId

    - #### description

          protected String description

    - #### name

          protected String name

    - #### primaryTag

          protected String primaryTag

    - #### secondaryTag

          protected String secondaryTag

    - #### summaryMinutes

          protected MetricDescriptor.SummaryIntervalMinutes summaryMinutes

    - #### type

          protected MetricDescriptor.Type type

  - ### Constructor Detail

    - #### MetricDescriptor.MetricDescriptorBuilder

          public MetricDescriptor.MetricDescriptorBuilder(String name)

      Creates a new `MetricDescriptor.MetricDescriptorBuilder` using only the arguments that are required to build a valid `MetricDescriptor`. If no other fields are set via other methods before building, the resulting `MetricDescriptor` will specify a `TimeStampedCounter` associated with no specific application, no primary or secondary tags, no description, and that the resulting `TimeStampedMetric` should be persisted using the default summarization interval and should not be visible via JMX.
      Parameters:
        `name` - a name for the `TimeStampedMetric` (e.g. "txPackets")

  - ### Method Detail

    - #### appId

          public MetricDescriptor.MetricDescriptorBuilder<T> appId(String toSet)

      Sets the application ID to apply to the `MetricDescriptor` that will be built.
      Parameters:
        `toSet` - application ID
      Returns:
        self

    - #### build

          public abstract T build()

      Build a `MetricDescriptor` subclass instance.
      Returns:
        the resulting `MetricDescriptor` subclass instance

    - #### description

          public MetricDescriptor.MetricDescriptorBuilder<T> description(String toSet)

      Sets the description to apply to the `MetricDescriptor` that will be built.
      Parameters:
        `toSet` - description
      Returns:
        self

    - #### name

          public MetricDescriptor.MetricDescriptorBuilder<T> name(String toSet)

      Sets the name to apply to the `MetricDescriptor` that will be built. Many metrics may have the same name (e.g. "txPackets") but can be distinguished from one another via the primary and secondary tags specified.
      Parameters:
        `toSet` - name
      Returns:
        self

    - #### persist

          public MetricDescriptor.MetricDescriptorBuilder<T> persist(boolean toSet)

      Sets the flag that indicates whether the `MetricDescriptor` that will be built is to be persisted. `true` indicates that the value should be persisted, `false` that it shouldn't.
      Parameters:
        `toSet` - persistence flag
      Returns:
        self

    - #### primaryTag

          public MetricDescriptor.MetricDescriptorBuilder<T> primaryTag(String toSet)

      Sets the primary tag (e.g. "router-1.2.3.4") to apply to the `MetricDescriptor` that will be built. The tag can be anything that is a useful identifier to group metrics by.
      Parameters:
        `toSet` - primary tag
      Returns:
        self

    - #### publishToJmx

          public MetricDescriptor.MetricDescriptorBuilder<T> publishToJmx(boolean toSet)

      Sets the flag that indicates whether the `MetricDescriptor` that will be built should be made visible via JMX. `true` indicates that the value should be visible, `false` that it shouldn't.
      Parameters:
        `toSet` - JMX flag
      Returns:
        self

    - #### secondaryTag

          public MetricDescriptor.MetricDescriptorBuilder<T> secondaryTag(String toSet)

      Sets the secondary tag (e.g. "port1") to apply to the `MetricDescriptor` that will be built. The tag can be anything that is a useful identifier to group metrics by, but should make sense in the context of the specified primary tag.
      Parameters:
        `toSet` - secondary tag
      Returns:
        self

    - #### summaryMinutes

          public MetricDescriptor.MetricDescriptorBuilder<T> summaryMinutes(MetricDescriptor.SummaryIntervalMinutes toSet)

      Sets the number of minutes that should elapse between the persistence of summarized values to apply to the `MetricDescriptor` that will be built.
      Parameters:
        `toSet` - summarization interval (in minutes)
      Returns:
        self

    - #### type

          public MetricDescriptor.MetricDescriptorBuilder<T> type(MetricDescriptor.Type toSet)

      Sets the metric type to apply to the `MetricDescriptor` that will be built.
      Parameters:
        `toSet` - metric type
      Returns:
        self

Copyright © 2014. All Rights Reserved.