In mobile development exists solution for caching with RxJava usage, but there is no solutions for Kotlin Coroutines. The project is to provide this functionality to mobile community.
Added @EntryClass annotation that is used in @ProviderKey annotation to tell type that should be used for object serialization & deserialization. Pr links this issue: https://github.com/epam/CoroutinesCache/issues/11.
@EntryClass annotation has two params - first called rawType, kotlin class should be passed there, the second one - called type params with type vararg of EntryClass (used as type arguments for ParameterizedType). Here's usage examples:
@ProviderKey("key1", EntryClass(Data::class))
fun getData(data: Deferred<Data>): Deferred<Data>
@ProviderKey("key2", EntryClass(List::class, EntryClass(Data::class)))
fun getListData(data: Deferred<List<Data>>): Deferred<List<Data>>`
@ProviderKey("key3", EntryClass(Map::class, EntryClass(Int::class), EntryClass(Data::class)))
fun getMapData(data: Deferred<Map<Int, Data>>): Deferred<Map<Int, Data>>
Pushed two commits over comments above, please write opinion about JsonMapper interface (I think that newParameterizedType could be removed from interface, but maybe there are cases when user needs it)
Added
@EntryClass
annotation that is used in@ProviderKey
annotation to tell type that should be used for object serialization & deserialization. Pr links this issue: https://github.com/epam/CoroutinesCache/issues/11.@EntryClass
annotation has two params - first called rawType, kotlin class should be passed there, the second one - called type params with type vararg of EntryClass (used as type arguments for ParameterizedType). Here's usage examples:Please not that this PR also includes: https://github.com/epam/CoroutinesCache/pull/13