Class DelegatingGauge<T>

  • Type Parameters:
    T - data type reported by the underlying Gauge
    All Implemented Interfaces:
    Gauge<T>, Metric

    public class DelegatingGauge<T>
    extends Object
    implements Gauge<T>
    Implementation of Gauge for cataloging in the metrics registry that delegates its getValue() method invocations to a discovered bean method annotated with @Gauge.
    • Method Detail

      • newInstance

        public static <S> DelegatingGauge<S> newInstance​(Method method,
                                                         Object obj,
                                                         Class<S> clazz)
        Creates a new DelegatingGauge which will defer to the specified method on the object to retrieve the gauge of interest of the indicated type.
        Type Parameters:
        S - type of the underlying gauge
        Parameters:
        method - value-reporting method to be invoked to retrieve the gauge value
        obj - bean instance from which to retrieve the gauge value
        clazz - type of the underlying gauge
        Returns:
        DelegatingGauge
      • getValue

        public T getValue()
        Specified by:
        getValue in interface Gauge<T>