'Can we say that Dagger @Bind is more SRP-based than @Provides is?

I'm wondering if I understand SRP correctly using the Dagger under the hood as example.

@Binds processed code


For example, if I have

@Module
abstract class ModuleA {
  @Binds
  abstract fun provideStorage(storage: SharedStorage): Storage

}

In such a case annotation processor generates the follow code to initialize dagger graph:

private void initialize() {
  this.sharedStorageProvider = SharedStorage_Factory.create();
}

@Provides processed code


And if I have (make concrete class and instance (non-static) function):

@Module
class StorageModule {
   @Provides
   fun provideStorage(): Storage {
      return SharedStorage()
   }
}

Annotation processor generates the follow code:

private void initialize(final StorageModule storageModuleParam) {
    this.provideStorageProvider = StorageModule_ProvideStorageFactory.create(storageModuleParam);
  }

Question:


Am I right if I say that @Binds annotation is designed in such a way that it follows the SRP principle more than @Provides?

I've found this post (last dot) about separation, but haven't found thoughts about SRP



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source