Created
December 12, 2018 09:03
-
-
Save abhirockzz/55e6eb268a6ede25ae60705d2f5462cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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