Please enable JavaScript.
Coggle requires JavaScript to display documents.
Dagger 2 (@Binds (@BindsOptionalOf (Optional.of(...)), Construct the…
Dagger 2
@Binds
Construct the instance
Implementation-to-interface
One INput, One OUTput
abstract methods
@BindsOptionalOf
Optional.of(...)
input - class with
Inject
constructor
Binds
and
Provides
possible together
@Subcomponent
has parent
Component
(or
Subcomponent
)
can access any type of parent
it types are hidden from parent
modules
@Subcomponent.Factory
@BindsInstance
parameter(s)
creates instance of
Subcomponent
requestable in parent
@Subcomponent.Builder
Types
Lazy<>
Provider<>
Optional<>
Producer<>
Produced<>
MembersInjector<>
@Provides
similar to
Inject
constructor
concrete methods
create instance
parameters == dependencies
@Qualifier
for same datatypes
Differentiate instances
@Named
@Component
interface
abstract class
modules
@Component.Builder
@Component.Factory
@Module
collection of dagger "instructions"
For reuse in different context
modular
subcomponents=
bridge between
Component
's
should be children of
includes
other module
@Scope
shared instance for each scope
@Singletone
Globally shared instance
lifetime
Equals of component lifetime
with that scope
user logical name only
@Reusable
@Inject
constructor
fields
recursive
Collections
@IntoMap
Key
@StringKey
@IntKey
@MapKey
@ClassKey
@LongKey
@IntoSet
@ElementsIntoSet
multibinding
@Multibinds
ContributeAndroidInjector
its a sugar for
Subcomponent