kailan
02/16/2017, 12:04 PMsalomonbrys
07/28/2017, 9:54 AMjdorleans
09/15/2017, 4:50 PMerased
similar to what’s suggested in the docs:
erased<Set<String>> will yield a TypeToken representing Set<*>.
In my case, I’m trying to do like:
bind<MyClass<*>>() with multiton { p: Obj<T> -> MyClass<T>(p) }
and
kodein.with(p).Instance(erased<MyClass<T>>())
Basically, what I’m trying to do is to create a bind for MyClass regardless the generics T it must receive. So, I’m binding it with bind<MyClass<*>>
. However, it seems that erased<MyClass<T>>
generated `MyClass`instead of MyClass<*>
as mentioned on the docs for the case with Set
.
Is there anything I can do to make this right?dave08
09/24/2017, 4:50 PMcom.github.salomonbrys.kodein.KodeinInjector$UninjectedException: Value has not been injected
, with no indication to what hasn't been injected...dave08
09/26/2017, 1:08 PMinline fun <reified T: Any> Kodein.Builder.singleton(noinline creator: suspend NoArgBindingKodein.() -> T) = SingletonCoroutineBinding(generic(), creator)
class SingletonCoroutineBinding<T : Any>(override val createdType: TypeToken<T>, creator: suspend NoArgBindingKodein.() -> T) : ASingleton<T>(creator) {
override fun factoryName() = "singleton"
}
But I'm getting that init
is internal in ASingleton
...?kristofdho
10/04/2017, 3:37 PMpasssy
10/21/2017, 8:27 PMian.shaun.thomas
10/28/2017, 9:23 PMkristofdho
10/29/2017, 7:23 PMeygraber
10/29/2017, 9:31 PMpasssy
11/15/2017, 10:55 AMian.shaun.thomas
01/10/2018, 1:37 PMmariodroid
01/16/2018, 7:05 AMSharedPreferences
?
bind<Foo>() with provider {Foo(instance()) }
where my Foo
class requires in the constracture shared preferences
I add the module in this way:
kodein.addConfig {
import(androidModule)
BaseAppComponent()
}
dimsuz
01/26/2018, 10:49 AMbind
which causes this, but I do not understand what other Object
does it override. If someone could advise how to debug this, will be helpfulneworldlt
01/31/2018, 1:02 PMMarat Iskhakov
02/01/2018, 9:09 AMCaused by: com.github.salomonbrys.kodein.Kodein$NotFoundException: No provider found for bind<MyModel>() with ? { ? }
Is my kodein file with bindings should be in Application class and Application class must implement KodeinAware? I'll appreciate for some help. Thanks.salomonbrys
02/06/2018, 5:30 PMdavid.pacheco
02/07/2018, 10:58 AMandroidContextScope
it would provide the context. However, I tried your suggestion and now I get
com.github.salomonbrys.kodein.Kodein$NotFoundException: No factory found for bind<PersistenceService>() with ? { Object -> ? }
allanhasegawa
02/15/2018, 6:08 PMJoe
02/16/2018, 4:10 PMbind<OkHttpClient>() with factory { (socketFactory, standardHeaderInterceptor) ->
OkHttpClient
.Builder()
.socketFactory(socketFactory)
.addInterceptor(standardHeaderInterceptor)
.addInterceptor(instance<ICrashlyticsLoggingInterceptor>())
.addInterceptor(instance<HttpLoggingInterceptor>())
.build()
}
apatrida
02/19/2018, 7:24 PMJoe
02/26/2018, 3:52 PMneworldlt
02/26/2018, 4:34 PMhamutarto
03/04/2018, 2:13 PMneworldlt
03/08/2018, 3:45 PMhamutarto
03/11/2018, 1:23 PMleosan
03/13/2018, 4:10 PMbind<Job>(MyJob.TAG) with singleton { MyJob(instance()) }
bind<Job>(MyJob2.TAG) with singleton { MyJob2() }
class JobCreator(private val kodein: Kodein) : JobCreator {
override fun create(tag: String): Job? {
return kodein.instance(tag)
}
}
But I wonder if there’s a way to create this dependency in a transitive way without passing the kodein instance to the job creator…mate.herber
03/13/2018, 10:28 PMCaused by: java.lang.IllegalStateException: Fragment org.kodein.android.KodeinFragment must be a public static class to be properly recreated from instance state.
at android.app.BackStackRecord.doAddOp(BackStackRecord.java:429)
at android.app.BackStackRecord.add(BackStackRecord.java:409)
at org.kodein.android.RetainedKt$retainedKodein$1.invoke(retained.kt:26)
at org.kodein.android.RetainedKt$retainedKodein$1.invoke(Unknown Source:0)
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131)
...
edwardwongtl
03/26/2018, 5:23 AMbind<Subject<*> with singleton { ... }
and get val subject by instance<Subject<String>>
?apatrida
04/01/2018, 1:21 AMdirect
thing, making a bunch of my injection via default constructor parameters really long for no added value.apatrida
04/01/2018, 1:21 AMdirect
thing, making a bunch of my injection via default constructor parameters really long for no added value.streetsofboston
04/01/2018, 11:16 PMKodeinAware
to our constructors (and maybe making our constructor's classes KodeinAware
as well). Then you can use by kodein.instance()
or by instance()
to define class' properties.apatrida
04/03/2018, 4:07 AMkodein.direct.instance()
in the middle of everything, including the bindings themselves which now get hit by this. Sure, we can create a new extension function to put this method back on top, .... we'll work around it.salomonbrys
04/03/2018, 9:07 AMDKodein
in the entire application and never have to use direct
, simply create the Kodein object as such: val kodein = Kodein.direct { /* bindings */ }
val myValue = kodein.newInstance { Whatever(instance(), instance()) }
apatrida
04/03/2018, 5:42 PM