org.apache.cassandra.metrics

## Class CassandraMetricsRegistry.MetricName

- java.lang.Object
- - org.apache.cassandra.metrics.CassandraMetricsRegistry.MetricName

- All Implemented Interfaces:
    java.lang.Comparable<CassandraMetricsRegistry.MetricName>
  Enclosing class:
    CassandraMetricsRegistry

      public static class CassandraMetricsRegistry.MetricName
      extends java.lang.Object
      implements java.lang.Comparable<CassandraMetricsRegistry.MetricName>

  A value class encapsulating a metric's owning class and name.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MetricName(java.lang.Class<?> klass, java.lang.String name)` Creates a new `CassandraMetricsRegistry.MetricName` without a scope.
    `MetricName(java.lang.Class<?> klass, java.lang.String name, java.lang.String scope)` Creates a new `CassandraMetricsRegistry.MetricName` without a scope.
    `MetricName(java.lang.String group, java.lang.String type, java.lang.String name)` Creates a new `CassandraMetricsRegistry.MetricName` without a scope.
    `MetricName(java.lang.String group, java.lang.String type, java.lang.String name, java.lang.String scope)` Creates a new `CassandraMetricsRegistry.MetricName` without a scope.
    `MetricName(java.lang.String group, java.lang.String type, java.lang.String name, java.lang.String scope, java.lang.String mBeanName)` Creates a new `CassandraMetricsRegistry.MetricName` without a scope.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `chooseGroup(java.lang.String group, java.lang.Class<?> klass)` If the group is empty, use the package name of the given class.
    `static java.lang.String` | `chooseName(java.lang.String name, java.lang.reflect.Method method)` If name is empty, use the name of the given method.
    `static java.lang.String` | `chooseType(java.lang.String type, java.lang.Class<?> klass)` If the type is empty, use the simple name of the given class.
    `int` | `compareTo(CassandraMetricsRegistry.MetricName o)`
    `boolean` | `equals(java.lang.Object o)`
    `java.lang.String` | `getGroup()` Returns the group to which the `Metric` belongs.
    `javax.management.ObjectName` | `getMBeanName()` Returns the MBean name for the `Metric` identified by this metric name.
    `java.lang.String` | `getMetricName()`
    `java.lang.String` | `getName()` Returns the name of the `Metric`.
    `java.lang.String` | `getScope()` Returns the scope of the `Metric`.
    `java.lang.String` | `getType()` Returns the type to which the `Metric` belongs.
    `int` | `hashCode()`
    `boolean` | `hasScope()` Returns `true` if the `Metric` has a scope, `false` otherwise.
    `java.lang.String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MetricName

          public MetricName(java.lang.Class<?> klass,
                            java.lang.String name)

      Creates a new `CassandraMetricsRegistry.MetricName` without a scope.
      Parameters:
        `klass` - the `Class` to which the `Metric` belongs
        `name` - the name of the `Metric`

    - #### MetricName

          public MetricName(java.lang.String group,
                            java.lang.String type,
                            java.lang.String name)

      Creates a new `CassandraMetricsRegistry.MetricName` without a scope.
      Parameters:
        `group` - the group to which the `Metric` belongs
        `type` - the type to which the `Metric` belongs
        `name` - the name of the `Metric`

    - #### MetricName

          public MetricName(java.lang.Class<?> klass,
                            java.lang.String name,
                            java.lang.String scope)

      Creates a new `CassandraMetricsRegistry.MetricName` without a scope.
      Parameters:
        `klass` - the `Class` to which the `Metric` belongs
        `name` - the name of the `Metric`
        `scope` - the scope of the `Metric`

    - #### MetricName

          public MetricName(java.lang.String group,
                            java.lang.String type,
                            java.lang.String name,
                            java.lang.String scope)

      Creates a new `CassandraMetricsRegistry.MetricName` without a scope.
      Parameters:
        `group` - the group to which the `Metric` belongs
        `type` - the type to which the `Metric` belongs
        `name` - the name of the `Metric`
        `scope` - the scope of the `Metric`

    - #### MetricName

          public MetricName(java.lang.String group,
                            java.lang.String type,
                            java.lang.String name,
                            java.lang.String scope,
                            java.lang.String mBeanName)

      Creates a new `CassandraMetricsRegistry.MetricName` without a scope.
      Parameters:
        `group` - the group to which the `Metric` belongs
        `type` - the type to which the `Metric` belongs
        `name` - the name of the `Metric`
        `scope` - the scope of the `Metric`
        `mBeanName` - the 'ObjectName', represented as a string, to use when registering the MBean.

  - ### Method Detail

    - #### getGroup

          public java.lang.String getGroup()

      Returns the group to which the `Metric` belongs. For class-based metrics, this will be the package name of the `Class` to which the `Metric` belongs.
      Returns:
        the group to which the `Metric` belongs

    - #### getType

          public java.lang.String getType()

      Returns the type to which the `Metric` belongs. For class-based metrics, this will be the simple class name of the `Class` to which the `Metric` belongs.
      Returns:
        the type to which the `Metric` belongs

    - #### getName

          public java.lang.String getName()

      Returns the name of the `Metric`.
      Returns:
        the name of the `Metric`

    - #### getMetricName

          public java.lang.String getMetricName()

    - #### getScope

          public java.lang.String getScope()

      Returns the scope of the `Metric`.
      Returns:
        the scope of the `Metric`

    - #### hasScope

          public boolean hasScope()

      Returns `true` if the `Metric` has a scope, `false` otherwise.
      Returns:
        `true` if the `Metric` has a scope

    - #### getMBeanName

          public javax.management.ObjectName getMBeanName()

      Returns the MBean name for the `Metric` identified by this metric name.
      Returns:
        the MBean name

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### compareTo

          public int compareTo(CassandraMetricsRegistry.MetricName o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<CassandraMetricsRegistry.MetricName>`

    - #### chooseGroup

          public static java.lang.String chooseGroup(java.lang.String group,
                                                     java.lang.Class<?> klass)

      If the group is empty, use the package name of the given class. Otherwise use group
      Parameters:
        `group` - The group to use by default
        `klass` - The class being tracked
      Returns:
        a group for the metric

    - #### chooseType

          public static java.lang.String chooseType(java.lang.String type,
                                                    java.lang.Class<?> klass)

      If the type is empty, use the simple name of the given class. Otherwise use type
      Parameters:
        `type` - The type to use by default
        `klass` - The class being tracked
      Returns:
        a type for the metric

    - #### chooseName

          public static java.lang.String chooseName(java.lang.String name,
                                                    java.lang.reflect.Method method)

      If name is empty, use the name of the given method. Otherwise use name
      Parameters:
        `name` - The name to use by default
        `method` - The method being tracked
      Returns:
        a name for the metric

Copyright © 2018 The Apache Software Foundation