Series implements Comparable<Series> { public String toDSL() { final Iterator<String> tags = this.tags .entrySet() .stream() .map(e -> DSL.dumpString(e.getKey()) + "=" + DSL.dumpString(e.getValue())) .iterator(); final Iterator<String> resource = this.resource .entrySet() .stream() .map(e -> DSL.dumpString(e.getKey()) + "=" + DSL.dumpString(e.getValue())) .iterator(); return DSL.dumpString(key) + " " + "{" + TAGS_JOINER.join(tags) + "}" + " " + "{" + TAGS_JOINER.join(resource) + "}"; } @JsonCreator  Series(
        @JsonProperty("key") String key, @JsonProperty("tags") SortedMap<String, String> tags,
        @JsonProperty("resource") Optional<SortedMap<String, String>> resource
    );  Series(final String key, final SortedMap<String, String> tags);  Series(
        final String key, final SortedMap<String, String> tags,
        final SortedMap<String, String> resource
    ); String getKey(); SortedMap<String, String> getTags(); SortedMap<String, String> getResource(); String hash(); @Override int hashCode(); @JsonIgnore HashCode getHashCodeTagOnly(); @Override boolean equals(Object obj); static Series empty(); static Series of(String key); static Series of(String key, Map<String, String> tags); static Series of(String key, Map<String, String> tags, Map<String, String> resource); static Series of(String key, Set<Map.Entry<String, String>> tagEntries); static Series of(
        String key, Iterator<Map.Entry<String, String>> tagPairs
    ); static Series of(
        String key, Iterator<Map.Entry<String, String>> tagPairs,
        Iterator<Map.Entry<String, String>> resourcePairs
    ); static Series of(
        String key, Map<String, String> tags, SortedMap<String, String> resource
    ); Series withResource(SortedMap<String, String> resource); @Override int compareTo(Series o); String toDSL(); String toString(); static final Joiner TAGS_JOINER; }
@Test public void toDSLTest() { final Series a = Series.of("system.cpu-user-perc", ImmutableMap.of("role", "heroicapi", "host", "heroicapi1.sto.spotify.net", "site", "sto")); assertEquals( "system.cpu-user-perc {host=heroicapi1.sto.spotify.net, role=heroicapi, site=sto} {}", a.toDSL()); }