Replies: 1 comment
-
Hello, here is the behavior in question. static class SimpleContainer {
public String word = "word";
protected Map<String, String> properties;
@JsonAnyGetter
public Map<String, String> getProperties() {
return properties;
}
public void setProperties(Map<String, String> properties) {
this.properties = properties;
}
}
public void testSimpleContainer() throws Exception {
SimpleContainer c = new SimpleContainer();
c.setProperties(new HashMap<String, String>());
assertEquals("{\"word\":\"word\"}", MAPPER.writeValueAsString(c));
}
public void testSimpleContainer2() throws Exception {
SimpleContainer c = new SimpleContainer();
c.setProperties(null);
assertEquals("{\"word\":\"word\"}", MAPPER.writeValueAsString(c));
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, how does the
JsonAnyGetter
annotation deal with the following two scenarios:Map<?, ?>
field is emptyMap<?, ?>
field is nullDo I have to add
JsonInclude(Include.NON_EMPTY)
, or doesJsonAnyGetter
handle this already?Thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions