T
- the core Android type to be injected@Beta public final class DispatchingAndroidInjector<T> extends Object implements AndroidInjector<T>
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
.Modifier and Type | Class and Description |
---|---|
static class |
DispatchingAndroidInjector.InvalidInjectorBindingException
Exception thrown if an incorrect binding is made for a
AndroidInjector.Factory . |
AndroidInjector.Builder<T>, AndroidInjector.Factory<T>
Modifier and Type | Method and Description |
---|---|
void |
inject(T instance)
Performs members-injection on
instance . |
boolean |
maybeInject(T instance)
Attempts to perform members-injection on
instance , returning true if
successful, false otherwise. |
@CanIgnoreReturnValue public boolean maybeInject(T instance)
instance
, returning true
if
successful, false
otherwise.DispatchingAndroidInjector.InvalidInjectorBindingException
- if the injector factory bound for a class does not
inject instances of that classpublic void inject(T instance)
instance
.inject
in interface AndroidInjector<T>
DispatchingAndroidInjector.InvalidInjectorBindingException
- if the injector factory bound for a class does not
inject instances of that classIllegalArgumentException
- if no AndroidInjector.Factory
is bound for instance
Copyright © 2012–2017 The Dagger Authors. All rights reserved.