/** * Installs a provider either in the scope or the pool of unbound providers. * * @param clazz the class for which to install the provider. * @param bindingName the name, possibly {@code null}, for which to install the scoped provider. * @param internalProvider the internal provider to install. * @param isBound whether or not the provider is bound to the scope or belongs to the pool of unbound providers. * @param isTestProvider whether or not is a test provider, installed through a Test Module that should override * existing providers for the same class-bindingname. * @param <T> the type of {@code clazz}. * * Note to maintainers : we don't use this method directly, both {@link #installBoundProvider(Class, String, InternalProviderImpl, boolean)} * and {@link #installUnBoundProvider(Class, String, InternalProviderImpl)} * are a facade of this method and make the calls more clear. */ private <T> InternalProviderImpl installInternalProvider(Class<T> clazz, String bindingName, InternalProviderImpl<? extends T> internalProvider, boolean isBound, boolean isTestProvider) { if (bindingName == null) { if (isBound) { return installUnNamedProvider(mapClassesToUnNamedBoundProviders, clazz, internalProvider, isTestProvider); } else { return installUnNamedProvider(mapClassesToUnNamedUnBoundProviders, clazz, internalProvider, isTestProvider); } } else { return installNamedProvider(mapClassesToNamedBoundProviders, clazz, bindingName, internalProvider, isTestProvider); } }
/** * Installs a provider either in the scope or the pool of unbound providers. * * @param clazz the class for which to install the provider. * @param bindingName the name, possibly {@code null}, for which to install the scoped provider. * @param internalProvider the internal provider to install. * @param isBound whether or not the provider is bound to the scope or belongs to the pool of unbound providers * @param <T> the type of {@code clazz}. * * Note to maintainers : we don't use this method directly, both {@link #installBoundProvider(Class, String, InternalProviderImpl)} * and {@link #installUnBoundProvider(Class, String, InternalProviderImpl)} * are a facade of this method and make the calls more clear. */ private <T> InternalProviderImpl installInternalProvider(Class<T> clazz, String bindingName, InternalProviderImpl<? extends T> internalProvider, boolean isBound) { if (bindingName == null) { if (isBound) { return installUnNamedProvider(mapClassesToUnNamedBoundProviders, clazz, internalProvider); } else { return installUnNamedProvider(mapClassesToUnNamedUnBoundProviders, clazz, internalProvider); } } else { return installNamedProvider(mapClassesToNamedBoundProviders, clazz, bindingName, internalProvider); } }
/** * Installs a provider either in the scope or the pool of unbound providers. * * @param clazz the class for which to install the provider. * @param bindingName the name, possibly {@code null}, for which to install the scoped provider. * @param internalProvider the internal provider to install. * @param isBound whether or not the provider is bound to the scope or belongs to the pool of unbound providers. * @param isTestProvider whether or not is a test provider, installed through a Test Module that should override * existing providers for the same class-bindingname. * @param <T> the type of {@code clazz}. * * Note to maintainers : we don't use this method directly, both {@link #installBoundProvider(Class, String, InternalProviderImpl, boolean)} * and {@link #installUnBoundProvider(Class, String, InternalProviderImpl)} * are a facade of this method and make the calls more clear. */ private <T> InternalProviderImpl installInternalProvider(Class<T> clazz, String bindingName, InternalProviderImpl<? extends T> internalProvider, boolean isBound, boolean isTestProvider) { if (bindingName == null) { if (isBound) { return installUnNamedProvider(mapClassesToUnNamedBoundProviders, clazz, internalProvider, isTestProvider); } else { return installUnNamedProvider(mapClassesToUnNamedUnBoundProviders, clazz, internalProvider, isTestProvider); } } else { return installNamedProvider(mapClassesToNamedBoundProviders, clazz, bindingName, internalProvider, isTestProvider); } }