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

com.ringcentral.platform.metrics.var.objectVar.AbstractObjectVar Maven / Gradle / Ivy

package com.ringcentral.platform.metrics.var.objectVar;

import com.ringcentral.platform.metrics.labels.LabelValue;
import com.ringcentral.platform.metrics.measurables.Measurable;
import com.ringcentral.platform.metrics.names.MetricName;
import com.ringcentral.platform.metrics.var.AbstractVar;
import com.ringcentral.platform.metrics.var.configs.VarConfig;

import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Supplier;

public class AbstractObjectVar extends AbstractVar implements ObjectVar {

    public interface ObjectVarInstanceMaker extends InstanceMaker {}

    public static class DefaultObjectVarInstanceMaker implements ObjectVarInstanceMaker {

        public static DefaultObjectVarInstanceMaker INSTANCE = new DefaultObjectVarInstanceMaker();

        @Override
        public ObjectVarInstance makeInstance(
            MetricName name,
            List labelValues,
            boolean totalInstance,
            boolean labeledMetricTotalInstance,
            boolean nonDecreasing,
            Measurable valueMeasurable,
            Supplier valueSupplier) {

            return new DefaultObjectVarInstance(
                name,
                labelValues,
                totalInstance,
                labeledMetricTotalInstance,
                nonDecreasing,
                valueMeasurable,
                valueSupplier);
        }
    }

    protected AbstractObjectVar(
        MetricName name,
        VarConfig config,
        Measurable valueMeasurable,
        Supplier valueSupplier,
        ScheduledExecutorService executor) {

        super(
            name,
            config,
            valueMeasurable,
            valueSupplier,
            DefaultObjectVarInstanceMaker.INSTANCE,
            executor);
    }

    protected AbstractObjectVar(
        MetricName name,
        VarConfig config,
        Measurable valueMeasurable,
        Supplier valueSupplier,
        InstanceMaker instanceMaker,
        ScheduledExecutorService executor) {

        super(
            name,
            config,
            valueMeasurable,
            valueSupplier,
            instanceMaker,
            executor);
    }
}