mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-02-07 07:00:49 +03:00
Add docs for abstract callable and singleton providers
This commit is contained in:
parent
144665ef3f
commit
28c73d13ca
|
@ -54,8 +54,18 @@ any kind of injection.
|
||||||
Delegation of :py:class:`Callable` providers is the same as
|
Delegation of :py:class:`Callable` providers is the same as
|
||||||
:py:class:`Factory` providers delegation, please follow
|
:py:class:`Factory` providers delegation, please follow
|
||||||
:ref:`factory_providers_delegation` section for examples (with exception
|
:ref:`factory_providers_delegation` section for examples (with exception
|
||||||
about using :py:class:`DelegatedCallable` instead of
|
of using :py:class:`DelegatedCallable` instead of
|
||||||
:py:class:`DelegatedFactory`).
|
:py:class:`DelegatedFactory`).
|
||||||
|
|
||||||
|
Abstract callable providers
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
:py:class:`AbstractCallable` provider is a :py:class:`Callable` provider that
|
||||||
|
must be explicitly overridden before calling.
|
||||||
|
|
||||||
|
Behaviour of :py:class:`AbstractCallable` providers is the same as of
|
||||||
|
:py:class:`AbstractFactory`, please follow :ref:`abstract_factory_providers`
|
||||||
|
section for examples (with exception of using :py:class:`AbstractCallable`
|
||||||
|
provider instead of :py:class:`AbstractFactory`).
|
||||||
|
|
||||||
.. disqus::
|
.. disqus::
|
||||||
|
|
|
@ -106,16 +106,18 @@ provided type:
|
||||||
:language: python
|
:language: python
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
|
.. _abstract_factory_providers:
|
||||||
|
|
||||||
Abstract factory providers
|
Abstract factory providers
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
:py:class:`AbstractFactory` is a :py:class:`Factory` provider that must be
|
:py:class:`AbstractFactory` provider is a :py:class:`Factory` provider that
|
||||||
explicitly overridden before calling.
|
must be explicitly overridden before calling.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Overriding of :py:class:`AbstractFactory` is possible only by another
|
Overriding of :py:class:`AbstractFactory` provider is possible only by
|
||||||
:py:class:`Factory` provider.
|
another :py:class:`Factory` provider.
|
||||||
|
|
||||||
:py:class:`AbstractFactory` provider is useful when it is needed to specify
|
:py:class:`AbstractFactory` provider is useful when it is needed to specify
|
||||||
explicitly that it only provides abstraction, but not an implementation.
|
explicitly that it only provides abstraction, but not an implementation.
|
||||||
|
|
|
@ -65,7 +65,7 @@ any kind of injection.
|
||||||
Delegation of :py:class:`Singleton` providers is the same as
|
Delegation of :py:class:`Singleton` providers is the same as
|
||||||
:py:class:`Factory` providers delegation, please follow
|
:py:class:`Factory` providers delegation, please follow
|
||||||
:ref:`factory_providers_delegation` section for examples (with exception
|
:ref:`factory_providers_delegation` section for examples (with exception
|
||||||
about using :py:class:`DelegatedSingleton` instead of
|
of using :py:class:`DelegatedSingleton` instead of
|
||||||
:py:class:`DelegatedFactory`).
|
:py:class:`DelegatedFactory`).
|
||||||
|
|
||||||
Singleton providers specialization
|
Singleton providers specialization
|
||||||
|
@ -78,6 +78,17 @@ Specialization of :py:class:`Singleton` providers is the same as
|
||||||
:py:class:`Factory` providers specialization, please follow
|
:py:class:`Factory` providers specialization, please follow
|
||||||
:ref:`factory_providers_specialization` section for examples.
|
:ref:`factory_providers_specialization` section for examples.
|
||||||
|
|
||||||
|
Abstract singleton providers
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
:py:class:`AbstractSingleton` provider is a :py:class:`Singleton` provider that
|
||||||
|
must be explicitly overridden before calling.
|
||||||
|
|
||||||
|
Behaviour of :py:class:`AbstractSingleton` providers is the same as of
|
||||||
|
:py:class:`AbstractFactory`, please follow :ref:`abstract_factory_providers`
|
||||||
|
section for examples (with exception of using :py:class:`AbstractSingleton`
|
||||||
|
provider instead of :py:class:`AbstractFactory`).
|
||||||
|
|
||||||
Singleton providers and multi-threading
|
Singleton providers and multi-threading
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user