static String measureValueDescription() { StringBuilder description = new StringBuilder("Measure value. Value type depends on metric type:"); description.append("<ul>"); for (Metric.ValueType metricType : Metric.ValueType.values()) { description.append("<li>"); description.append(String.format("%s - %s", metricType.name(), metricTypeWsDescription(metricType))); description.append("</li>"); } description.append("</ul>"); return description.toString(); }
static String measureValueDescription() { StringBuilder description = new StringBuilder("Measure value. Value type depends on metric type:"); description.append("<ul>"); for (Metric.ValueType metricType : Metric.ValueType.values()) { description.append("<li>"); description.append(String.format("%s - %s", metricType.name(), metricTypeWsDescription(metricType))); description.append("</li>"); } description.append("</ul>"); return description.toString(); }
@Override public void handle(Request request, Response response) throws Exception { JsonWriter json = response.newJsonWriter(); json.beginObject(); json.name("types"); json.beginArray(); for (Metric.ValueType metricType : Metric.ValueType.values()) { json.value(metricType.name()); } json.endArray(); json.endObject(); json.close(); } }
public static String[] names() { ValueType[] values = values(); String[] names = new String[values.length]; for (int i = 0; i < values.length; i += 1) { names[i] = values[i].name(); } return names; } }
public static MetricDto newMetricDto() { Metric.ValueType[] metricTypes = Metric.ValueType.values(); return new MetricDto() .setId(RandomUtils.nextInt()) .setKey(RandomStringUtils.randomAlphanumeric(64)) .setShortName(RandomStringUtils.randomAlphanumeric(64)) .setValueType(metricTypes[RandomUtils.nextInt(metricTypes.length - 1)].name()) .setDomain(RandomStringUtils.randomAlphanumeric(64)) .setDescription(RandomStringUtils.randomAlphanumeric(250)) .setBestValue(RandomUtils.nextDouble()) .setDeleteHistoricalData(RandomUtils.nextBoolean()) .setDirection(RandomUtils.nextInt()) .setHidden(RandomUtils.nextBoolean()) .setEnabled(true) .setOptimizedBestValue(RandomUtils.nextBoolean()) .setQualitative(RandomUtils.nextBoolean()) .setUserManaged(RandomUtils.nextBoolean()) .setWorstValue(RandomUtils.nextDouble()); } }
public static String[] names() { ValueType[] values = values(); String[] names = new String[values.length]; for (int i = 0; i < values.length; i += 1) { names[i] = values[i].name(); } return names; } }
@Override public void handle(Request request, Response response) throws Exception { JsonWriter json = response.newJsonWriter(); json.beginObject(); json.name("types"); json.beginArray(); for (Metric.ValueType metricType : Metric.ValueType.values()) { json.value(metricType.name()); } json.endArray(); json.endObject(); json.close(); } }