I have an old singleton class which was used in ab...
# kodein
j
I have an old singleton class which was used in about 20 other classes, previously via
MyClass.getInstance()
.. I've now converted this to a Kodein singleton, however I'm wondering if there's still a way I can access it from one particular class without
@Inject
? there's one particular class I don't really want to update because it is intertwined with a lot of other stuff and in the interest of time (and testing capacity) I would like to leave that class mostly untouched. so most of the classes now just get
MyClass
injected to them, but is there some way I can retrieve it from the other class I mentioned which I'd like to avoid making large changes to?
t
Not sure I understand what you want, but if you have access to the kodein instance in that class, you can always do e.g.
val myClass by kodein.instance<MyClass>()
or using direct-style