FasterXML/jackson-module-scala — Issue #9: Collection Serializers do not support `JsonSerialize.Inclusion.NON_EMPTY`
Author: christophercurrie
Created: 2011-10-20 18:02:36+00:00
State: open

From Todd Vierling:

It looks like jackson 1.9.0 still doesn't have a way to hook into this functionality, which is part of PropertyBuilder, without subclassing BeanSerializerFactory. I did create an implementation of that here, which supports anything that extends either Product (such as Option or any case class) or TraversableLike (all collection classes except TraversableOnce):

https://github.com/tvierling/jackson-module-scala/blob/master/src/main/scala/com/fasterxml/jackson/module/scala/ser/ScalaPropertyBuilder.scala

I didn't submit a pull request because it's incomplete; to use it, it must be done at the caller level (since a module cannot override BeanSerializerFactory), as in:

mapper.setSerializerFactory(new ScalaSerializerFactory)

That's obviously suboptimal, and rather needs a hook in Module.SetupContext to make it "cleaner". What would you suggest I do from here?