User DocumentationOne minute descriptionTwo minute tutorial Five minute introduction Advanced Topics FAQ Container Components Terminology Mock Objects Inversion of Control Types PatternsInversion of ControlDependency Injection Constructor Injection Setter Injection Interface-Impl Separation Lifecycle Antipatterns Developer DocumentationHow To ContributeRelative Volunteering Release Process Project InformationSloganMailing lists Source Repositories Open Issues Blog entries Statistics Team Sister Projects TShirts MiscellaneousDifferentiatorsNirvana Full Sitemap |
ContainerThe container in PicoContainer has the following responsibilities:
Assembling componentsThe container instantiates a new instance of a component when it is requested. If the component have any dependencies the container looks for and instantiates all of them too.This behaviour can be customized using component adapters, see Extending PicoContainer with ComponentAdapter for more information.Storing component instancesThe container stores a reference to the component instance as they are instantiated. You can access this instance using the key that the component was registered with.This behaviour can also be customized using component adapters, see Extending PicoContainer with ComponentAdapter for more information.Maintaining lifecycleThe container can also enforce a simple lifecycle (start, stop, dispose) on components contained within it. It is further described on Lifecycle.Container hierarchiesEach container can have a parent and a container can also be a component in another container. This effectively creates an hierarchy of containers.The parent is used for resolving components not found locally. So if a container is looking for a component to resolve a dependency it looks first in locally in it's own container and then looks for the same component in the parent container. The opposite is not true though, a parent container never looks for a component in any of it's child-containers. By placing a container in a child-container you override the same component if it exists in a sub-container. This is only true for local components or components in child-containers, components placed in a parent-container do not use the overridden component.API Overview
|