INNER CODE UNIT · Kotlin
BindingsMap
kosi-libs/Kodein · kodein-di/src/commonMain/kotlin/org/kodein/di/BindingsMap.kt:27
public typealias BindingsMap = Map<DI.Key<*, *, *>, List<DIDefinition<*, *, *>>>
private fun BindingsMap.descriptionImpl(withOverrides: Boolean, ident: Int, keyBindDisp: DI.Key<*, *, *>.() -> String, bindingDisp: DIBinding<*, *, *>.() -> String): String {
fun StringBuilder.appendBindings(ident: Int, entries: List<Map.Entry<DI.Key<*, *, *>, List<DIDefinition<*, *, *>>>>) =
entries.forEach {
val keyDescription = it.key.keyBindDisp()
append("${" ".repeat(ident)}$keyDescription { ${it.value.first().binding.bindingDisp()} }")
if (withOverrides) {
val subIdent = keyDescription.length - 4
it.value.subList(1, it.value.size).forEach {
append("${" ".repeat(subIdent)}overrides ${it.binding.bindingDisp()}")
}
}
append("\n")
}
val byModule = entries.groupBy { it.value.first().fromModule }