本文整理匯總了Java中com.codahale.metrics.Metric.getClass方法的典型用法代碼示例。如果您正苦於以下問題:Java Metric.getClass方法的具體用法?Java Metric.getClass怎麽用?Java Metric.getClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.codahale.metrics.Metric
的用法示例。
在下文中一共展示了Metric.getClass方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: notifyListenerOfAddedMetric
import com.codahale.metrics.Metric; //導入方法依賴的package包/類
private void notifyListenerOfAddedMetric(
final SemanticMetricRegistryListener listener, final Metric metric, final MetricId name
) {
if (metric instanceof Gauge) {
listener.onGaugeAdded(name, (Gauge<?>) metric);
} else if (metric instanceof Counter) {
listener.onCounterAdded(name, (Counter) metric);
} else if (metric instanceof Histogram) {
listener.onHistogramAdded(name, (Histogram) metric);
} else if (metric instanceof Meter) {
listener.onMeterAdded(name, (Meter) metric);
} else if (metric instanceof Timer) {
listener.onTimerAdded(name, (Timer) metric);
} else if (metric instanceof DerivingMeter) {
listener.onDerivingMeterAdded(name, (DerivingMeter) metric);
} else {
throw new IllegalArgumentException("Unknown metric type: " + metric.getClass());
}
}
示例2: notifyListenerOfRemovedMetric
import com.codahale.metrics.Metric; //導入方法依賴的package包/類
private void notifyListenerOfRemovedMetric(
final MetricId name, final Metric metric, final SemanticMetricRegistryListener listener
) {
if (metric instanceof Gauge) {
listener.onGaugeRemoved(name);
} else if (metric instanceof Counter) {
listener.onCounterRemoved(name);
} else if (metric instanceof Histogram) {
listener.onHistogramRemoved(name);
} else if (metric instanceof Meter) {
listener.onMeterRemoved(name);
} else if (metric instanceof Timer) {
listener.onTimerRemoved(name);
} else if (metric instanceof DerivingMeter) {
listener.onDerivingMeterRemoved(name);
} else {
throw new IllegalArgumentException("Unknown metric type: " + metric.getClass());
}
}
示例3: notifyListenerOfAddedMetric
import com.codahale.metrics.Metric; //導入方法依賴的package包/類
private void notifyListenerOfAddedMetric(
final MetricRegistryListener listener, final Metric metric, final String name
) {
if(metric instanceof Gauge) {
listener.onGaugeAdded(name, (Gauge<?>) metric);
} else if(metric instanceof Counter) {
listener.onCounterAdded(name, (Counter) metric);
} else if(metric instanceof Histogram) {
listener.onHistogramAdded(name, (Histogram) metric);
} else if(metric instanceof Meter) {
listener.onMeterAdded(name, (Meter) metric);
} else if(metric instanceof Timer) {
listener.onTimerAdded(name, (Timer) metric);
} else {
throw new IllegalArgumentException("Unsupported metric type: " + metric.getClass());
}
}
示例4: notifyListenerOfRemovedMetric
import com.codahale.metrics.Metric; //導入方法依賴的package包/類
private void notifyListenerOfRemovedMetric(
final String name, final Metric metric, final MetricRegistryListener listener
) {
if(metric instanceof Gauge) {
listener.onGaugeRemoved(name);
} else if(metric instanceof Counter) {
listener.onCounterRemoved(name);
} else if(metric instanceof Histogram) {
listener.onHistogramRemoved(name);
} else if(metric instanceof Meter) {
listener.onMeterRemoved(name);
} else if(metric instanceof Timer) {
listener.onTimerRemoved(name);
} else {
throw new IllegalArgumentException("Unsupported metric type: " + metric.getClass());
}
}
示例5: getPostfixForMetric
import com.codahale.metrics.Metric; //導入方法依賴的package包/類
private String getPostfixForMetric(Metric metric) {
Preconditions.checkNotNull(metric);
Class<? extends Metric> metricClass = metric.getClass();
if (Counter.class.isAssignableFrom(metricClass)) {
return COUNTER_POSTFIX;
} else if (Gauge.class.isAssignableFrom(metricClass)) {
return GAUGE_POSTFIX;
} else if (Timer.class.isAssignableFrom(metricClass)) {
return TIMER_POSTFIX;
} else if (Meter.class.isAssignableFrom(metricClass)) {
return METER_POSTFIX;
} else if (Histogram.class.isAssignableFrom(metricClass)) {
return HISTOGRAM_POSTFIX;
} else {
return null;
}
}