mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 08:43:02 +08:00
refactor(framework): make AgentContext capabilities non-null and infer capability type on registration
This commit is contained in:
@@ -15,9 +15,9 @@ object AgentContext {
|
|||||||
get() = _modules
|
get() = _modules
|
||||||
|
|
||||||
private val _capabilities =
|
private val _capabilities =
|
||||||
mutableMapOf<Class<*>, Any?>()
|
mutableMapOf<Class<*>, Any>()
|
||||||
|
|
||||||
val capabilities: Map<Class<*>, Any?>
|
val capabilities: Map<Class<*>, Any>
|
||||||
get() = _capabilities
|
get() = _capabilities
|
||||||
|
|
||||||
private val _additionalComponents = mutableSetOf<Any>()
|
private val _additionalComponents = mutableSetOf<Any>()
|
||||||
@@ -34,8 +34,8 @@ object AgentContext {
|
|||||||
_modules[name] = module
|
_modules[name] = module
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> addCapability(type: Class<T>, value: T) {
|
fun addCapability(value: Any) {
|
||||||
_capabilities[type] = value
|
_capabilities[value::class.java] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addAdditionalComponent(instance: Any): Boolean {
|
fun addAdditionalComponent(instance: Any): Boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user