Create ContributesNode annotation to generate module and assistedFactory for node.

This commit is contained in:
ganfra
2023-01-05 11:22:38 +01:00
parent 9365dc0e74
commit f4ac368d07
4 changed files with 165 additions and 27 deletions

View File

@@ -0,0 +1,23 @@
package io.element.android.x.anvilannotations
import kotlin.reflect.KClass
/**
* Adds Node to the specified component graph.
* Equivalent to the following declaration:
*
* @Module
* @ContributesTo(Scope::class)
* abstract class YourNodeModule {
* @Binds
* @IntoMap
* @NodeKey(YourNode::class)
* abstract fun bindYourNodeFactory(factory: YourNode.Factory): AssistedNodeFactory<*>
*}
*/
@Target(AnnotationTarget.CLASS)
annotation class ContributesNode(
val scope: KClass<*>,
)