pip_services3_container.refer.LinkReferencesDecorator module

pip_services3_container.refer.LinkReferencesDecorator

Link 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.LinkReferencesDecorator.LinkReferencesDecorator(next_references: pip_services3_commons.refer.IReferences.IReferences, top_references: pip_services3_commons.refer.IReferences.IReferences)

Bases: pip_services3_container.refer.ReferencesDecorator.ReferencesDecorator, pip_services3_commons.run.IOpenable.IOpenable

References decorator that automatically sets references to newly added components that implement IReferenceable interface and unsets references from removed components that implement IUnreferenceable interface.

close(correlation_id: Optional[str])

Closes component and frees used resources.

Parameters

correlation_id – (optional) transaction id to trace execution through call chain.

is_open()bool

Checks if the component is opened.

Returns

true if the component has been opened and false otherwise.

open(correlation_id: Optional[str])

Opens the component.

Parameters

correlation_id – (optional) transaction id to trace execution through call chain.

put(locator: Any = None, component: Any = None) → Any

Puts a new component into this component map.

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

  • component – a component component to be added.

remove(locator: Any) → Any

Removes a previously added component that matches specified locator. If many references match the locator, it removes only the first one. When all references shall be removed, use remove_all() method instead.

Parameters

locator – a locator to remove component

Returns

the removed component component.

remove_all(locator: Any) → List[Any]

Removes all component references that match the specified locator.

Parameters

locator – the locator to remove references by.

Returns

a list, containing all removed references.