Package dagger.android
Class DispatchingAndroidInjector<T>
java.lang.Object
dagger.android.DispatchingAndroidInjector<T>
- Type Parameters:
T
- the core Android type to be injected
- All Implemented Interfaces:
AndroidInjector<T>
Performs members-injection on instances of core Android types (e.g.
Activity
, Fragment
) that are constructed by the Android framework and not by Dagger. This class relies on
an injected mapping from each concrete class to an AndroidInjector.Factory
for an AndroidInjector
of that class. Each concrete class must have its own entry in the map, even if
it extends another class which is already present in the map. Calls Object.getClass()
on
the instance in order to find the appropriate AndroidInjector.Factory
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Exception thrown if an incorrect binding is made for aAndroidInjector.Factory
.Nested classes/interfaces inherited from interface dagger.android.AndroidInjector
AndroidInjector.Builder<T>, AndroidInjector.Factory<T>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Performs members-injection oninstance
.boolean
maybeInject
(T instance) Attempts to perform members-injection oninstance
, returningtrue
if successful,false
otherwise.
-
Method Details
-
maybeInject
Attempts to perform members-injection oninstance
, returningtrue
if successful,false
otherwise.- Throws:
DispatchingAndroidInjector.InvalidInjectorBindingException
- if the injector factory bound for a class does not inject instances of that class
-
inject
Performs members-injection oninstance
.- Specified by:
inject
in interfaceAndroidInjector<T>
- Throws:
DispatchingAndroidInjector.InvalidInjectorBindingException
- if the injector factory bound for a class does not inject instances of that classIllegalArgumentException
- if noAndroidInjector.Factory
is bound forinstance
-