[FIR] Add ability to register user defined annotations for plugins

This commit is contained in:
Dmitriy Novozhilov
2020-04-27 18:02:09 +03:00
parent 8ecd3d8efe
commit 3d30ba9c19
2 changed files with 32 additions and 3 deletions
@@ -16,6 +16,10 @@ abstract class ComponentArrayOwner<K : Any, V : Any> {
protected fun registerComponent(tClass: KClass<out K>, value: V) {
componentArray[(typeRegistry.getId(tClass))] = value
}
protected operator fun get(tClass: KClass<out K>): V {
return componentArray[typeRegistry.getId(tClass)]
}
}
@@ -60,7 +64,7 @@ class ComponentArray<T : Any> {
data[index] = value
}
operator fun get(index: Int): T? {
operator fun get(index: Int): T {
@Suppress("UNCHECKED_CAST")
return data.getOrNull(index) as T
}