pip_services3_container.refer.BuildReferencesDecorator module

pip_services3_container.refer.BuildReferencesDecorator

Build references decorator implementation.

copyright

Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.

license

MIT, see LICENSE for more details.

class pip_services3_container.refer.BuildReferencesDecorator.BuildReferencesDecorator(next_references: pip_services3_commons.refer.IReferences.IReferences, top_references: pip_services3_commons.refer.IReferences.IReferences)

Bases: pip_services3_container.refer.ReferencesDecorator.ReferencesDecorator

References decorator that automatically creates missing components using available component factories upon component retrival.

clarify_locator(locator: Any, factory: pip_services3_components.build.IFactory.IFactory) → Any

Clarifies a component locator by merging two descriptors into one to replace missing fields. That allows to get a more complete descriptor that includes all possible fields.

Parameters
  • locator – a component locator to clarify.

  • factory – a factory that shall create the component.

Returns

clarified component descriptor (locator)

create(locator: Any, factory: pip_services3_components.build.IFactory.IFactory) → Any

Creates a component identified by given locator.

Parameters
  • locator – a locator to identify component to be created.

  • factory – a factory that shall create the component.

Returns

the created component.

find(locator: Any, required: bool) → List[Any]

Gets all component references that match specified locator.

Parameters
  • locator – the locator to find a component by.

  • required – forces to raise an exception if no component is found.

Returns

a list with matching component references.

find_factory(locator: Any) → Optional[pip_services3_components.build.IFactory.IFactory]

Finds a factory capable creating component by given descriptor from the components registered in the references.

Parameters

locator – a locator of component to be created.

Returns

found factory or null if factory was not found.