@Test public void testNullLabelThrows() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Label cannot be null."); metric.labels(new String[]{null}); }
public Child labels(String... labelValues) { if (labelValues.length != labelNames.size()) { throw new IllegalArgumentException("Incorrect number of labels."); } for (String label: labelValues) { if (label == null) { throw new IllegalArgumentException("Label cannot be null."); } } List<String> key = Arrays.asList(labelValues); Child c = children.get(key); if (c != null) { return c; } Child c2 = newChild(); Child tmp = children.putIfAbsent(key, c2); return tmp == null ? c2 : tmp; }
SimpleCollector extends Collector { public Child labels(String... labelValues) { if (labelValues.length != labelNames.size()) { throw new IllegalArgumentException("Incorrect number of labels."); } for (String label: labelValues) { if (label == null) { throw new IllegalArgumentException("Label cannot be null."); } } List<String> key = Arrays.asList(labelValues); Child c = children.get(key); if (c != null) { return c; } Child c2 = newChild(); Child tmp = children.putIfAbsent(key, c2); return tmp == null ? c2 : tmp; } }
SimpleCollector extends Collector { public Child labels(String... labelValues) { if (labelValues.length != labelNames.size()) { throw new IllegalArgumentException("Incorrect number of labels."); } for (String label: labelValues) { if (label == null) { throw new IllegalArgumentException("Label cannot be null."); } } List<String> key = Arrays.asList(labelValues); Child c = children.get(key); if (c != null) { return c; } Child c2 = newChild(); Child tmp = children.putIfAbsent(key, c2); return tmp == null ? c2 : tmp; } protected  SimpleCollector(Builder b); }
SimpleCollector extends Collector { public Child labels(String... labelValues) { if (labelValues.length != labelNames.size()) { throw new IllegalArgumentException("Incorrect number of labels."); } for (String label: labelValues) { if (label == null) { throw new IllegalArgumentException("Label cannot be null."); } } List<String> key = Arrays.asList(labelValues); Child c = children.get(key); if (c != null) { return c; } Child c2 = newChild(); Child tmp = children.putIfAbsent(key, c2); return tmp == null ? c2 : tmp; } protected  SimpleCollector(Builder b); Child labels(String... labelValues); void remove(String... labelValues); void clear(); T setChild(Child child, String... labelValues); }
SimpleCollector extends Collector { public Child labels(String... labelValues) { if (labelValues.length != labelNames.size()) { throw new IllegalArgumentException("Incorrect number of labels."); } for (String label: labelValues) { if (label == null) { throw new IllegalArgumentException("Label cannot be null."); } } List<String> key = Arrays.asList(labelValues); Child c = children.get(key); if (c != null) { return c; } Child c2 = newChild(); Child tmp = children.putIfAbsent(key, c2); return tmp == null ? c2 : tmp; } protected  SimpleCollector(Builder b); Child labels(String... labelValues); void remove(String... labelValues); void clear(); T setChild(Child child, String... labelValues);  }