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 a37cf3adde
commit 4fb063654f
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<*>,
)