/** * Creates a measure with a metric and an alert level * * @param metric the metric * @param level the alert level */ public Measure(Metric metric, Metric.Level level) { this.metric = metric; this.metricKey = metric.getKey(); if (level != null) { this.data = level.toString(); } }
/** * Sets an alert level as the data field * * @param level the alert level * @return the measure object instance */ public Measure setData(Metric.Level level) { if (level == null) { this.data = null; } else { this.data = level.toString(); } return this; }
/** @return transforms and returns the data fields as a level of alert */ public Metric.Level getDataAsLevel() { if (data != null) { return Metric.Level.valueOf(data); } return null; }