- 
                Notifications
    You must be signed in to change notification settings 
- Fork 57
Closed
Labels
guavapr-welcomeIssue for which progress most likely if someone submits a Pull RequestIssue for which progress most likely if someone submits a Pull Request
Milestone
Description
Add support for serializing and deserializing Guava's RangeMap class.
e.g.
record Grades(@JsonProperty RangeMap<Integer, String> gradeMap) {
}ObjectMapper mapper = new ObjectMapper();
RangeMap<Integer, String> map = TreeRangeMap.create();
map.put(Range.closedOpen(0, 60), "F");
map.put(Range.closedOpen(60, 70), "D");
map.put(Range.closedOpen(70, 80), "C");
map.put(Range.closedOpen(80, 90), "B");
map.put(Range.closed(90, 100), "A");
Grades grades = new Grades(map);
String json = mapper.writeValueAsString(grades); // expect RangeMap serialization to equal `asMapOfRanges()` below
Grades newGrades = mapper.readValue(json, Grades.class); // expect this to not throw InvalidDefinitionException
if (!grades.equals(newGrades)) new AssertionError("Deserialized grades should match original");{
  "grades": {
    "[0..60)": "F",
    "[60..70)": "D",
    "[70..80)": "C",
    "[80..90)": "B",
    "[90..100]": "A"
  }
}Metadata
Metadata
Assignees
Labels
guavapr-welcomeIssue for which progress most likely if someone submits a Pull RequestIssue for which progress most likely if someone submits a Pull Request