Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LinkReferencesDecorator

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

Hierarchy

Implements

  • IReferences
  • IOpenable

Index

Constructors

constructor

Properties

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[]

getAllLocators

  • getAllLocators(): any[]

getOneOptional

  • getOneOptional<T>(locator: any): T

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

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

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[]

Generated using TypeDoc