Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ContainerReferences

Container managed references that can be created from container configuration.

see

ManagedReferences

Hierarchy

Implements

  • any
  • any

Index

Constructors

constructor

Properties

Protected _builder

Protected _linker

Protected _references

_references: References

Protected _runner

nextReferences

nextReferences: IReferences

The next references or decorator in the chain.

topReferences

topReferences: IReferences

The decorator at the top of the chain.

Methods

close

  • close(correlationId: string, callback?: function): void
  • Closes component and frees used resources.

    Parameters

    • correlationId: string

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

    • Optional callback: function

      callback function that receives error or null no errors occured.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

find

  • find<T>(locator: any, required: boolean): T[]
  • Gets all component references that match specified locator.

    throws

    a [[ReferenceException]] when required is set to true but no references found.

    Type parameters

    • T

    Parameters

    • locator: any

      the locator to find a reference by.

    • required: boolean

      forces to raise an exception if no reference is found.

    Returns T[]

    a list with matching component references.

getAll

  • getAll(): any[]
  • Gets all component references registered in this reference map.

    Returns any[]

    a list with component references.

getAllLocators

  • getAllLocators(): any[]
  • Gets locators for all registered component references in this reference map.

    Returns any[]

    a list with component locators.

getOneOptional

  • getOneOptional<T>(locator: any): T
  • Gets an optional component reference that matches specified locator.

    Type parameters

    • T

    Parameters

    • locator: any

      the locator to find references by.

    Returns T

    a matching component reference or null if nothing was found.

getOneRequired

  • getOneRequired<T>(locator: any): T
  • Gets a required component reference that matches specified locator.

    throws

    a [[ReferenceException]] when no references found.

    Type parameters

    • T

    Parameters

    • locator: any

      the locator to find a reference by.

    Returns T

    a matching component reference.

getOptional

  • getOptional<T>(locator: any): T[]
  • Gets all component references that match specified locator.

    Type parameters

    • T

    Parameters

    • locator: any

      the locator to find references by.

    Returns T[]

    a list with matching component references or empty list if nothing was found.

getRequired

  • getRequired<T>(locator: any): T[]
  • Gets all component references that match specified locator. At least one component reference must be present. If it doesn't the method throws an error.

    throws

    a [[ReferenceException]] when no references found.

    Type parameters

    • T

    Parameters

    • locator: any

      the locator to find references by.

    Returns T[]

    a list with matching component references.

isOpen

  • isOpen(): boolean
  • Checks if the component is opened.

    Returns boolean

    true if the component has been opened and false otherwise.

open

  • open(correlationId: string, callback?: function): void
  • Opens the component.

    Parameters

    • correlationId: string

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

    • Optional callback: function

      callback function that receives error or null no errors occured.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

put

  • put(locator: any, component: any): any
  • Puts a new reference into this reference map.

    Parameters

    • locator: any

      a locator to find the reference by.

    • component: any

      a component reference to be added.

    Returns any

putFromConfig

  • Puts components into the references from container configuration.

    throws

    CreateException when one of component cannot be created.

    Parameters

    • config: ContainerConfig

      a container configuration with information of components to be added.

    Returns void

remove

  • remove(locator: any): any
  • Removes a previously added reference that matches specified locator. If many references match the locator, it removes only the first one. When all references shall be removed, use removeAll method instead.

    see

    removeAll

    Parameters

    • locator: any

      a locator to remove reference

    Returns any

    the removed component reference.

removeAll

  • removeAll(locator: any): any[]
  • Removes all component references that match the specified locator.

    Parameters

    • locator: any

      the locator to remove references by.

    Returns any[]

    a list, containing all removed references.

Static fromTuples

  • Creates a new ManagedReferences object filled with provided key-value pairs called tuples. Tuples parameters contain a sequence of locator1, component1, locator2, component2, ... pairs.

    Parameters

    • Rest ...tuples: any[]

      the tuples to fill a new ManagedReferences object.

    Returns ManagedReferences

    a new ManagedReferences object.

Generated using TypeDoc