add method that returns a string representation of the tags in Tags

This commit is contained in:
2018-03-19 19:29:22 +01:00
parent 5343c0d427
commit c581e352e4
2 changed files with 46 additions and 31 deletions

View File

@@ -225,4 +225,22 @@ public class Tags {
return new Tags(filename);
}
public String asString() {
final StringBuilder result = new StringBuilder();
final SortedSet<Tag> tags = toTags();
for (final Tag tag : tags) {
if (result.length() > 0) {
result.append(", ");
}
result.append(tag.getKey());
result.append(":");
result.append(tag.getValue());
}
return result.toString();
}
}