My class contains an initialized custom collection
class MyClass {
MyList<Integer> myList = MyList.create();
}
where MyList is a j.u.List. When deserializing, I get an exception saying
that there is no known deserializer for MyList ("Cannot find a deserializer
for non-concrete List type"), which is generally understandable, but I
already initialized it, so there's no need for one. Instead, I just want to
add the items to the list.
To demonstrate, I can add a private setter inside the class:
private void setMyList(List<Integer> ints) { ints.forEach(MyList::add); }
this works, but I don't think it should be needed. Specifically, Jackson
should not create any list. It needs to deserialize the values of the items
anyway; then instead of creating a list, add them to the existing one. It's
a List, so it should know to call 'add' ('put' for map).
I know there is @JsonMerge, and I thought that that's what I needed, but
just adding it to the field doesn't work, I still get the same exception.
Am I not understanding @JsonMerge or am I doing something wrong?
Thanks!
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jackson-user/af74c8b0-1516-4cc8-9117-be6808cf9223n%40googlegroups.com.