catatumbo icon indicating copy to clipboard operation
catatumbo copied to clipboard

Support persisting Generic Types

Open athieriot opened this issue 8 years ago • 2 comments

Hello,

We have the use case of wanting to persist generic types. (Ex: Document<SomeObject>). At runtime, after type erasure, the enclosing type is actually lost and so Catatumbo fail to be able to read the fields and annotations.

From reading and using Gson library, they solve this by accepting a ParameterizedType during Serialization/Deserialization: https://github.com/google/gson/blob/master/UserGuide.md#TOC-Serializing-and-Deserializing-Generic-Types

I was wondering if it was of some interest to support this behaviour? (Not just us I mean :smile:)

@spullabhotla Do you think it would be worthwhile to take a look at implementing that? (It might require a new set of methods in EntityManager so I'm not sure whether you want that feature or think about anything else...)

athieriot avatar Sep 25 '17 15:09 athieriot

@athieriot - Is Document<SomeObject> a top level entity or an embedded field in the entity?

sai-pullabhotla avatar Sep 27 '17 13:09 sai-pullabhotla

In our case, Document is a top level entity and only contains one Generic field (Which is stored as Embedded).

athieriot avatar Sep 27 '17 13:09 athieriot