All Downloads are FREE. Search and download functionalities are using the official Maven repository.

domain.DebugInfo.kt Maven / Gradle / Ivy

There is a newer version: 0.77.0
Show newest version
package de.peekandpoke.ultra.kontainer.domain

import de.peekandpoke.ultra.kontainer.InjectionType
import de.peekandpoke.ultra.kontainer.ServiceProvider
import java.time.Instant
import kotlin.reflect.KClass
import kotlin.reflect.KType

data class DebugInfo(
    val services: List,
    val config: Map
) {

    data class ServiceDebugInfo(
        val cls: ClassInfo,
        val type: ServiceProvider.Type,
        val definition: ServiceDefinitionInfo,
        val instances: List,
    )

    data class ServiceDefinitionInfo(
        val creates: ClassInfo,
        val injectionType: InjectionType,
        val injects: List,
        val codeLocation: CodeLocation,
        val overwrites: ServiceDefinitionInfo?,
    ) {
        data class CodeLocation(
            val location: String,
        )
    }

    data class InstanceDebugInfo(
        val createdAt: Instant,
        val cls: ClassInfo
    )

    @Suppress("DataClassPrivateConstructor")
    data class ClassInfo private constructor(
        val fqn: String
    ) {
        companion object {
            fun  of(cls: KClass): ClassInfo = ClassInfo(
                fqn = cls.java.name
            )

            fun of(type: KType): ClassInfo? = when (val cls = type.classifier) {
                is KClass<*> -> of(cls)
                else -> null
            }
        }
    }

    @Suppress("DataClassPrivateConstructor")
    data class ParamInfo(
        val name: String,
        val provisionType: ProvisionType,
        val classes: List,
    ) {
        enum class ProvisionType {
            Direct,
            Lazy;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy