Class DerivativeGauge<F,T>

java.lang.Object
com.codahale.metrics.DerivativeGauge<F,T>
Type Parameters:
F - the base gauge's value type
T - the derivative type
All Implemented Interfaces:
Gauge<T>, Metric

public abstract class DerivativeGauge<F,T> extends Object implements Gauge<T>
A gauge whose value is derived from the value of another gauge.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Gauge<F>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new derivative with the given base gauge.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the metric's current value.
    protected abstract T
    transform(F value)
    Transforms the value of the base gauge to the value of this gauge.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • base

      private final Gauge<F> base
  • Constructor Details

    • DerivativeGauge

      protected DerivativeGauge(Gauge<F> base)
      Creates a new derivative with the given base gauge.
      Parameters:
      base - the gauge from which to derive this gauge's value
  • Method Details

    • getValue

      public T getValue()
      Description copied from interface: Gauge
      Returns the metric's current value.
      Specified by:
      getValue in interface Gauge<F>
      Returns:
      the metric's current value
    • transform

      protected abstract T transform(F value)
      Transforms the value of the base gauge to the value of this gauge.
      Parameters:
      value - the value of the base gauge
      Returns:
      this gauge's value