Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Scope
- @Retention(AnnotationRetention.RUNTIME)
- annotation class MyTestScope
- class A {
- fun get() = 1
- }
- @Module
- class TestModule {
- @Provides
- @MyTestScope
- fun provideA(): A {
- return A()
- }
- }
- @MyTestScope
- @Component(dependencies = [AppComponent::class],
- modules = [TestModule::class])
- interface DependentComponent {
- @Component.Builder
- interface Builder {
- @BindsInstance
- fun appComponent(component: AppComponent): Builder
- fun build(): DependentComponent
- }
- fun inject(application: Application)
- }
- @Singleton
- @Component(modules = [
- AndroidInjectionModule::class,
- ActivityModule::class,
- // etc ....
- ])
- interface AppComponent {
- @Component.Builder
- interface Builder {
- @BindsInstance
- fun language(language: Language): Builder
- @BindsInstance
- fun appContext(appContext: Context): Builder
- fun build(): AppComponent
- }
- fun inject(application: Application)
- }
Add Comment
Please, Sign In to add comment