https://kotlinlang.org logo
#dagger
Title
# dagger
p

pollux-

10/26/2020, 7:10 PM
I'm using Dagger @Binds to binding the interface to implementation. I have genric mapper which transform one object to other.
Copy code
interface DataMapper<T, R> {
     fun transform(from: T): R
 }
So I have couple of Data mapper in each use case layer . Let's I have something like this
Copy code
class AccountDataMapper @Inject constructor():
DataMapper<Account,Result<Account>>{
override fun transform(account : Account){
}
}
How can I bind this. I have many mapper in the like Login Mapper,User mapper. When I use thr binder it's complaining that @Binds method parameter type must be assignable to the return type @Binds
abstract fun bindAccountMapper(mapper AccountDataMapper) : DataMapper<Account,Result<Account>>
Thanks in advance
r

Rafal

10/27/2020, 1:58 PM
Looks fine, maybe check your imports? You might have imported wrong
Result<>
class
p

pollux-

10/27/2020, 5:48 PM
Ya might be .. 😭 this one annoys me a lot. Let me double check .. thanks bro
12 Views