Skip to content

Instantly share code, notes, and snippets.

@abhirockzz
Created December 12, 2018 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhirockzz/55e6eb268a6ede25ae60705d2f5462cb to your computer and use it in GitHub Desktop.
Save abhirockzz/55e6eb268a6ede25ae60705d2f5462cb to your computer and use it in GitHub Desktop.
/**
* POJO representing list of Metric(s)
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Metrics {
private final List<Metric> metrics;
public Metrics() {
metrics = new ArrayList<>();
}
public Metrics add(String source, String machine, String cpu) {
metrics.add(new Metric(source, machine, cpu));
return this;
}
public Metrics add(Metrics anotherMetrics) {
anotherMetrics.metrics.forEach((metric) -> {
metrics.add(metric);
});
return this;
}
@Override
public String toString() {
return "Metrics{" + "metrics=" + metrics + '}';
}
public static Metrics EMPTY(){
return new Metrics();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment