https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
u

ursus

02/19/2019, 3:01 AM
should this mapping be just thrown in FooRepository or should the be some wrapper around retrofitApi interface?
h

Hadi Tok

02/19/2019, 9:21 AM
we have custom jackson (de)serializer handles this stuff. Other libraries has similar solutions.
u

ursus

02/19/2019, 3:25 PM
Deserializer for what exactly, json directly to db model?
u

540grunkspin

02/21/2019, 8:58 AM
You should take a look at this guide. https://futurestud.io/tutorials/gson-advanced-customizing-de-serialization-and-adding-instance-creators-via-jsonadapter. I think that gson actually has a default handling of just using the enum name but this might not be what you want and in that case you need to add a type adapter to gson.
u

ursus

02/22/2019, 5:39 AM
Sorry, I meant query params etc, not json request body. If there was some preprocessor like so, it would be nice, but it is not, so im asking at what layer would you guys do this, since I feel like doing it in repository leaks the api details there for no reason
2 Views