@Test public void should_serialize_json() throws Exception { Map<String, Object> values = new HashMap<>(); values.put("foo", "bar"); values.put("build", singletonMap("version", "1.0.0")); Info info = Info.from(values); String json = objectMapper.writeValueAsString(info); DocumentContext doc = JsonPath.parse(json); assertThat(doc.read("$.foo", String.class)).isEqualTo("bar"); assertThat(doc.read("$.build.version", String.class)).isEqualTo("1.0.0"); }
public static Info from(@Nullable Map<String, Object> values) { if (values == null || values.isEmpty()) { return empty(); } return new Info(values); }
Info implements Serializable { public static Info from(@Nullable Map<String, Object> values) { if (values == null || values.isEmpty()) { return empty(); } return new Info(values); } }
Info implements Serializable { public static Info from(@Nullable Map<String, Object> values) { if (values == null || values.isEmpty()) { return empty(); } return new Info(values); } private  Info(Map<String, Object> values); }
Info implements Serializable { public static Info from(@Nullable Map<String, Object> values) { if (values == null || values.isEmpty()) { return empty(); } return new Info(values); } private  Info(Map<String, Object> values); static Info from(@Nullable Map<String, Object> values); static Info empty(); @JsonAnyGetter Map<String, Object> getValues(); }
Info implements Serializable { public static Info from(@Nullable Map<String, Object> values) { if (values == null || values.isEmpty()) { return empty(); } return new Info(values); } private  Info(Map<String, Object> values); static Info from(@Nullable Map<String, Object> values); static Info empty(); @JsonAnyGetter Map<String, Object> getValues();  }