@Test public void metrics_from_children_are_added() { MetricSet child1 = new MetricSet("child1", ImmutableList.of(new Metric("child1_metric"))); MetricSet child2 = new MetricSet("child2", ImmutableList.of(new Metric("child2_metric"))); MetricSet parent = new MetricSet("parent", emptyList(), ImmutableList.of(child1, child2)); Map<String, Metric> parentMetrics = parent.getMetrics(); assertEquals(2, parentMetrics.size()); assertNotNull(parentMetrics.get("child1_metric")); assertNotNull(parentMetrics.get("child2_metric")); }
public final Map<String, Metric> getMetrics() { return unmodifiableMap(flatten(metrics, children)); }
MetricSet { public final Map<String, Metric> getMetrics() { return unmodifiableMap(flatten(metrics, children)); } }
MetricSet { public final Map<String, Metric> getMetrics() { return unmodifiableMap(flatten(metrics, children)); } MetricSet(String id, Collection<Metric> metrics);  MetricSet(String id, Collection<Metric> metrics, Collection<MetricSet> children); }
MetricSet { public final Map<String, Metric> getMetrics() { return unmodifiableMap(flatten(metrics, children)); } MetricSet(String id, Collection<Metric> metrics);  MetricSet(String id, Collection<Metric> metrics, Collection<MetricSet> children); static MetricSet empty(); final String getId(); final Map<String, Metric> getMetrics(); @Override boolean equals(Object o); @Override int hashCode(); }
MetricSet { public final Map<String, Metric> getMetrics() { return unmodifiableMap(flatten(metrics, children)); } MetricSet(String id, Collection<Metric> metrics);  MetricSet(String id, Collection<Metric> metrics, Collection<MetricSet> children); static MetricSet empty(); final String getId(); final Map<String, Metric> getMetrics(); @Override boolean equals(Object o); @Override int hashCode();  }