Dependency Initialization
A Component factory instance is constructed using a builder object provided in a static class named by convention as the Component interface name preceded by "Dagger". For example if the Component interface is named ApplicationComponent, then the builder class name is DaggerApplicationComponent. A builder object has methods to set the modules to participate in object construction and a build() method to return a Component instance.
Opposite is an example from the AndroidHelloTwoDbs application showing how the DaggerAndroidHelloTwoDbsComponent builder is used to construct the Component factory. Extracted directly from the factory is a PersistenceContext object so the application can perform database operations. Other objects are accessed indirectly by field injection or participation in a peristence task Subcomponent factory.
Notice that the @Module-annotated class AndroidHelloTwoDbsModule encapsulates what objects need to be constructed and wired together to make database access possible. The module is passed 2 parameters to be used by the Conponent factory, one being a reference to the containing class object. This is an example of dynamic late object binding, which makes Dagger 2 a flexible system for dependency injection.
