Package-level declarations

Types

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class ContributesBinding(val scope: KClass<*>, val boundType: KClass<*> = Unit::class, val replaces: Array<KClass<*>> = [], val priority: ContributesBinding.Priority = Priority.NORMAL, val ignoreQualifier: Boolean = false, val rank: Int = RANK_NORMAL)

Generate a Dagger binding method for an annotated class and contributes this binding method to the given scope. Imagine this example:

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class ContributesMultibinding(val scope: KClass<*>, val boundType: KClass<*> = Unit::class, val replaces: Array<KClass<*>> = [], val ignoreQualifier: Boolean = false)

Generate a Dagger multibinding method for an annotated class and contributes this multibinding method to the given scope. Imagine this example:

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class ContributesSubcomponent(val scope: KClass<*>, val parentScope: KClass<*>, val modules: Array<KClass<*>> = [], val exclude: Array<KClass<*>> = [], val replaces: Array<KClass<*>> = [])

Similar to MergeSubcomponent, but with the main difference that the subcomponent is generated and modules, bindings and component interfaces are merged whenever the component with parentScope is processed.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class ContributesTo(val scope: KClass<*>, val replaces: Array<KClass<*>> = [])

Marks a Dagger module or component interface to be included in the Dagger dependency graph in the given scope. Anvil automatically adds the module to the list of included modules in the Dagger component marked with MergeComponent. For component interfaces it will make the Dagger component extend the interface.

Link copied to clipboard

Indicates that the annotated Anvil API is experimental and subject to change.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class MergeComponent(val scope: KClass<*>, val modules: Array<KClass<*>> = [], val dependencies: Array<KClass<*>> = [], val exclude: Array<KClass<*>> = [])

Dagger components that should automatically include Dagger modules and component interfaces for the given scope require this annotation instead of @Component. The Kotlin compiler plugin will add the @Component annotation to this interface. The parameters modules and dependencies are preserved in the @Component annotation.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class MergeSubcomponent(val scope: KClass<*>, val modules: Array<KClass<*>> = [], val exclude: Array<KClass<*>> = [])

Dagger subcomponents that should automatically include Dagger modules and component interfaces for the given scope require this annotation instead of @Subcomponent. The Kotlin compiler plugin will add the @Subcomponent annotation to this interface. The modules parameter is preserved in the @Subcomponent annotation.