google / guava

Google core libraries for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help Jackson with Guava Deserializers

paulmarcelinbejan opened this issue · comments

1. What are you trying to do?

It is not possible to read an object with a Table as a field from Kafka since behind the scenes, spring framework uses Jackson to deserialize objects, and at the moment there are a lot of Guava Data Types that are not handled by Jackson

https://github.com/FasterXML/jackson-datatypes-collections/blob/2.17/guava/src/main/java/com/fasterxml/jackson/datatype/guava/GuavaDeserializers.java

2. What's the best code you can write to accomplish that without the new feature?

I have switched from Guava Table to Map<C, Map<R, V>>

3. What would that same code look like if we added your feature?

probably something like:

public HashBasedTable(Map<R, Map<C, V>> table);

(Optional) What would the method signatures for your feature look like?

No response

Concrete Use Cases

I need to deserialize an object that has a Table as a field.
The serialization is already implemented.

Packages

com.google.common.collect

Checklist

This issue looks a lot like #6893. Is there anything that blocks Jackson from implementing the missing deserialization support?

(Related Jackson ticket: FasterXML/jackson-datatypes-collections#1. CC @cowtowncoder.)

It does seem to me that the proper path forward is for Jackson to implement a deserializer for Guava's ImmutableTable rather than to introduce a public constructor.

Agreed: I don't think there is anything Guava should need to add (besides, any new addition would be for latest Guava and Jackson module is designed to work with a wide range of Guava versions so cannot rely on latest).
Someone just needs to take time to write a Jackson JsonDeserializer for Table type.

OK, thanks for confirming. I'll go ahead and close this issue then.

And thank you, @paulmarcelinbejan, for thinking about ways to make the experience of using Guava easier!