janvladimirmostert
09/23/2020, 7:23 PMclass TestClass {
init {
println("????????????")
}
companion object {
init {
println("!!!!!!!!!!!!!")
}
fun touch() {
// empty function to trigger init
}
}
}
object TestObject {
init {
println(">>>>>>>>>>>>>>>>>")
}
fun touch() {
// empty function to trigger init
}
}
In my main, i literally have to call touch before the TestObject and TestClass' init is called
@JvmStatic
fun main(args: Array<String>) {
TestClass.touch()
TestObject.touch()
}
i'm tryin to implement some form of inversion of control where classes register themselve to a central place
My use-case is building the equivalent of a Controller, but instead of wiring in URLs in a central place, each Controller wires itself in to the central pointnanodeath
09/23/2020, 7:30 PMjanvladimirmostert
09/23/2020, 7:31 PMnanodeath
09/23/2020, 7:31 PMnanodeath
09/23/2020, 7:32 PMgetClassesImplementing(RequiresInitializationInterface::class)
might be sufficientnanodeath
09/23/2020, 7:32 PMnanodeath
09/23/2020, 7:32 PMnanodeath
09/23/2020, 7:34 PMjanvladimirmostert
09/23/2020, 7:34 PMjanvladimirmostert
09/23/2020, 7:36 PMBig Chungus
09/23/2020, 10:37 PMnanodeath
09/23/2020, 11:40 PMjanvladimirmostert
09/24/2020, 7:41 AMBig Chungus
09/24/2020, 7:46 AMjanvladimirmostert
09/24/2020, 7:48 AMBig Chungus
09/24/2020, 7:48 AMBig Chungus
09/24/2020, 7:49 AMjanvladimirmostert
09/24/2020, 7:49 AMBig Chungus
09/24/2020, 7:51 AMjanvladimirmostert
09/24/2020, 7:54 AM