Skip to content

Commit c86f4f7

Browse files
committed
use reified
1 parent 46e8d5e commit c86f4f7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

app/src/main/kotlin/com/hana053/micropost/interactor/InteractorModule.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,33 @@ fun interactorModule() = Kodein.Module {
4141
}
4242

4343
bind<LoginInteractor>() with singleton {
44-
instance<Retrofit>().create(LoginInteractor::class.java)
44+
instance<Retrofit>().create<LoginInteractor>()
4545
}
4646

4747
bind<FeedInteractor>() with singleton {
48-
instance<Retrofit>().create(FeedInteractor::class.java)
48+
instance<Retrofit>().create<FeedInteractor>()
4949
}
5050

5151
bind<UserInteractor>() with singleton {
52-
instance<Retrofit>().create(UserInteractor::class.java)
52+
instance<Retrofit>().create<UserInteractor>()
5353
}
5454

5555
bind<RelationshipInteractor>() with singleton {
56-
instance<Retrofit>().create(RelationshipInteractor::class.java)
56+
instance<Retrofit>().create<RelationshipInteractor>()
5757
}
5858

5959
bind<UserMicropostInteractor>() with singleton {
60-
instance<Retrofit>().create(UserMicropostInteractor::class.java)
60+
instance<Retrofit>().create<UserMicropostInteractor>()
6161
}
6262

6363
bind<MicropostInteractor>() with singleton {
64-
instance<Retrofit>().create(MicropostInteractor::class.java)
64+
instance<Retrofit>().create<MicropostInteractor>()
6565
}
6666

6767
bind<RelatedUserListInteractor>() with singleton {
68-
instance<Retrofit>().create(RelatedUserListInteractor::class.java)
68+
instance<Retrofit>().create<RelatedUserListInteractor>()
6969
}
70-
7170
}
7271

72+
inline fun <reified T : Any> Retrofit.create(): T = create(T::class.java)
73+

0 commit comments

Comments
 (0)