Injector implementation.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| pack-priv static class | InjectorImpl.
Options that control how the injector behaves. |
| pack-priv static enum | InjectorImpl.
some limitations on what just in time bindings are allowed. |
| pack-priv static interface | InjectorImpl.
Invokes a method. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final InjectorBindingData | |
| pack-priv final ConstructorInjectorStore | constructors
Cached constructor injectors for each type |
| private final InjectorJitBindingData | |
| private final ThreadLocal | localContext
Holds Object[] as a mutable wrapper, rather than InternalContext, since array operations are faster than ThreadLocal.set() / .get() operations. |
| pack-priv Lookups | |
| pack-priv MembersInjectorStore | membersInjectorStore
Cached field and method injectors for each type. |
| pack-priv final InjectorImpl. | |
| pack-priv final InjectorImpl | |
| pack-priv ProvisionListenerCallbackStore | provisionListenerStore
Cached provision listener callbacks for each key. |
| public static final TypeLiteral | |
| pack-priv final Set | userRequestedMembersInjectorTypes
The set of types passed to |
| Access | Constructor and Description |
|---|---|
| pack-priv | InjectorImpl(InjectorImpl parent, InjectorBindingData bindingData, InjectorJitBindingData jitBindingData, InjectorImpl.
|
| Modifier and Type | Method and Description |
|---|---|
| private boolean | cleanup(BindingImpl<?> binding, Set<Key<?>> encountered)
Iterates through the binding's dependencies to clean up any stray bindings that were leftover from a failed JIT binding. |
| private <T> BindingImpl | Returns: the binding if it could be resolved, or null if the binding doesn't existConverts a constant string binding to the required type. |
| public Injector | createChildInjector(Iterable<? extends Module> modules)
Implements com. |
| public Injector | createChildInjector(Module... modules)
Implements com. |
| private <T> BindingImpl | createImplementedByBinding(Key<T> key, Scoping scoping, ImplementedBy implementedBy, Errors errors, Consumer<CreationListener> creationListenerCallback)
Creates a binding for a type annotated with @ImplementedBy. |
| private <T> BindingImpl | createJustInTimeBinding(Key<T> key, Errors errors, boolean jitDisabled, InjectorImpl.
Returns a new just-in-time binding created by resolving |
| private <T> BindingImpl | createJustInTimeBindingRecursive(Key<T> key, Errors errors, boolean jitDisabled, InjectorImpl.
Attempts to create a just-in-time binding for |
| private <T> BindingImpl | |
| pack-priv <T> SingleParameterInjector | |
| pack-priv <T> BindingImpl | createProvidedByBinding(Key<T> key, Scoping scoping, ProvidedBy providedBy, Errors errors)
Creates a binding for a type annotated with @ProvidedBy. |
| private <T> BindingImpl | createSyntheticProviderBinding(Key<Provider<T>> key, Errors errors)
Creates a synthetic binding to |
| private <T> BindingImpl | createTypeLiteralBinding(Key<TypeLiteral<T>> key, Errors errors)
Converts a binding for a |
| pack-priv <T> BindingImpl | createUninitializedBinding(Key<T> key, Scoping scoping, Object source, Errors errors, boolean jitBinding, Consumer<CreationListener> creationListenerCallback)
Creates a binding for an injectable type with the given scope. |
| pack-priv InternalContext | |
| public <T> List | findBindingsByType(TypeLiteral<T> type)
Implements com. type.
|
| public Map | getAllBindings()
Implements com. |
| public Map | getAllMembersInjectorInjectionPoints()
Implements com. getMembersInjector (either directly
or indirectly, e.g. through injectMembers.
|
| public <T> BindingImpl | |
| public <T> Binding | getBinding(Class<T> type)
Implements com. |
| pack-priv InjectorBindingData | |
| pack-priv <T> BindingImpl | getBindingOrThrow(Key<T> key, Errors errors, InjectorImpl.
Gets a binding implementation. |
| public Map | getBindings()
Implements com. |
| public List | getElements()
Implements com. |
| public <T> BindingImpl | getExistingBinding(Key<T> key)
Implements com. |
| public <T> T | getInstance(Key<T> key)
Implements com. getProvider(key).get().
|
| public <T> T | getInstance(Class<T> type)
Implements com. getProvider(type).get().
|
| private Set | getInternalDependencies(BindingImpl<?> binding)
Safely gets the dependencies of possibly not initialized bindings. |
| pack-priv <T> InternalFactory | |
| pack-priv InjectorJitBindingData | |
| private <T> BindingImpl | getJustInTimeBinding(Key<T> key, Errors errors, InjectorImpl.
Returns a just-in-time binding for |
| pack-priv InternalContext | |
| public <T> MembersInjector | getMembersInjector(TypeLiteral<T>
type to get members injector for typeLiteral)Implements com. T.
|
| public <T> MembersInjector | getMembersInjector(Class<T>
type to get members injector for type)Implements com. T.
|
| pack-priv SingleParameterInjector | getParametersInjectors(List<Dependency<?>> parameters, Errors errors)
Returns parameter injectors, or |
| public Injector | getParent()
Implements com. null if this is a top-level injector.
|
| private static <T> Key | |
| public <T> Provider | getProvider(Class<T> type)
Implements com. |
| public <T> Provider | getProvider(final Key<T> key)
Implements com. |
| pack-priv <T> Provider | |
| public Map | getScopeBindings()
Implements com. |
| public Set | getTypeConverterBindings()
Implements com. |
| pack-priv <T> void | |
| pack-priv <T> void | |
| public void | injectMembers(Object
to inject members on instance)Implements com. instance.
|
| private static boolean | isMembersInjector(Key<?> key)
Returns true if the key type is MembersInjector (but not a subclass of MembersInjector). |
| private static boolean | |
| private static boolean | |
| private void | removeFailedJitBinding(Binding<?> binding, InjectionPoint ip)
Cleans up any state that may have been cached when constructing the JIT binding. |
| public String |