Dagger: @module and @provides: Define Classes and Methods Which Provide Dependencies
Dagger: @module and @provides: Define Classes and Methods Which Provide Dependencies
Object providers - sila ung magbibigay ng mga object sa ibang class. Kung baga
nasa kanila ung mga functions na need ng ibang class at need i share or nagpoprovide
ng dependencies.
@Module and @Provides: define classes and methods which provide dependencies
In Dagger 2, classes annotated with @Module are responsible for providing objects
which can be injected
Such classes can define methods annotated with @Provides. The returned objects from
these methods are available for dependency injection.
-------------------------------------------------------------------------
Object consumers - sila ung mga class na gagamit ng mga object or dependencies
You use the @Inject annotation to define a dependency. If you annotate a constructor
with @Inject, Dagger 2 can also use an instance of this object to fulfill dependencies. This
was done to avoid the definition of lots of @Provides methods for these objects.
-------------------------------------------------------------------------
Connecting consumers and providers
-------------------------------------------------------------------------
You can use the @Singleton annotation to indicate that there should be only one
instance of the object.