All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codahale.metrics.DerivativeGauge Maven / Gradle / Ivy

Go to download

Metrics is a Java library which gives you unparalleled insight into what your code does in production. Metrics provides a powerful toolkit of ways to measure the behavior of critical components in your production environment.

There is a newer version: 3.0.2
Show newest version
package com.codahale.metrics;

/**
 * A gauge whose value is derived from the value of another gauge.
 *
 * @param  the base gauge's value type
 * @param  the derivative type
 */
public abstract class DerivativeGauge implements Gauge {
    private final Gauge base;

    /**
     * Creates a new derivative with the given base gauge.
     *
     * @param base the gauge from which to derive this gauge's value
     */
    protected DerivativeGauge(Gauge base) {
        this.base = base;
    }

    @Override
    public T getValue() {
        return transform(base.getValue());
    }

    /**
     * Transforms the value of the base gauge to the value of this gauge.
     *
     * @param value the value of the base gauge
     * @return this gauge's value
     */
    protected abstract T transform(F value);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy