AbstractMetric (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.metrics2, class: AbstractMetric

Package org.apache.hadoop.metrics2

# Class AbstractMetric

java.lang.Object
org.apache.hadoop.metrics2.AbstractMetric

All Implemented Interfaces:
  `MetricsInfo`

@Public @Evolving public abstract class AbstractMetric extends Object implements MetricsInfo
The immutable metric

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AbstractMetric(MetricsInfo info)`
  Construct the metric

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `description()`
  Typically the description corresponds to annotation `Metric.about()` or the name of the class.
  `boolean`
  `equals(Object obj)`
  `int`
  `hashCode()`
  `protected MetricsInfo`
  `info()`
  `String`
  `name()`
  Typically name corresponds to annotation `Metric.value()` or the name of the class.
  `String`
  `toString()`
  `abstract MetricType`
  `type()`
  Get the type of the metric
  `abstract Number`
  `value()`
  Get the value of the metric
  `abstract void`
  `visit(MetricsVisitor visitor)`
  Accept a visitor interface

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

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

- ## Constructor Details

  - ### AbstractMetric

    protected AbstractMetric(MetricsInfo info)
    Construct the metric
    Parameters:
      `info` - about the metric

- ## Method Details

  - ### name

    public String name()
    Description copied from interface: `MetricsInfo`
    Typically name corresponds to annotation `Metric.value()` or the name of the class.
    Specified by:
      `name` in interface `MetricsInfo`
    Returns:
      the name of the metric/tag

  - ### description

    public String description()
    Description copied from interface: `MetricsInfo`
    Typically the description corresponds to annotation `Metric.about()` or the name of the class.
    Specified by:
      `description` in interface `MetricsInfo`
    Returns:
      the description of the metric/tag

  - ### info

    protected MetricsInfo info()

  - ### value

    public abstract Number value()
    Get the value of the metric
    Returns:
      the value of the metric

  - ### type

    public abstract MetricType type()
    Get the type of the metric
    Returns:
      the type of the metric

  - ### visit

    public abstract void visit(MetricsVisitor visitor)
    Accept a visitor interface
    Parameters:
      `visitor` - of the metric

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`