Hello, I have several classes (MyClassA, MyClassB...) sharing an interface (MyInterface), and I want to customize the inclusion setting for those POJOs, using my custom filter (MyValueFilter).
This is what I have so far: MAPPER.setSerializationInclusion(Include.NON_EMPTY); MAPPER.configOverride(MyInterface.class).setIncludeAsProperty( JsonInclude.Value.construct(Include.CUSTOM, Include.CUSTOM).withValueFilter(MyValueFilter.class)); The issue is that during serialization, config override lookup is based only on the POJO class, not the interface it is implementing, so the lookup is not returning the config override. If I use MAPPER.configOverride(MyClassA.class) instead of MAPPER.configOverride(MyInterface.class), this is working as expected, but of course only for MyClassA (not MyClasssB, MyClassC, etc.). Is there a method to override inclusion setting for all POJOs implementing a given interface? Side question: what I'm trying to achieve is filtering out "empty" POJO, ie. a POJO where all its fields are empty. MAPPER.setSerializationInclusion(Include.NON_EMPTY) is properly skipping the POJO empty fields, but I still get '"pojoName": { }' in my JSON output when all the fields are empty. I would like to define a method to determine if this POJO is empty. For Map, .isEmpty() is called, for String, .lenght() etc. I'd like to have the same mechanism to skip my POJOs, based on my own function. Thanks! Clément -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/b2d1e676-32e3-4cc3-8893-a9c12f6844fan%40googlegroups.com.