ManagedReferences

Managed references that in addition to keeping and locating references can also manage their lifecycle.

Extends: ReferencesDecorator

Implements: IOpenable

Description

The ManagedReferences class allows you to create managed references that in additon to keeping and locating references can also manage their lifecycle, such as:

  • Auto-creation of missing components using available factories
  • Auto-linking newly added components
  • Auto-opening newly added components
  • Auto-closing removed components

Constructors

Creates a new instance of the decorator.

public ManagedReferences(Object[] tuples)

  • tuples: Object[] - tuples where odd values are component locators (descriptors) and even values are component references

Fields

_references

References

protected _references: References

_builder

Builder

protected _builder: BuildReferencesDecorator

_linker

Linker

protected _linker: LinkReferencesDecorator

_runner

Runner

protected _runner: RunReferencesDecorator

Instance methods

close

Closes the component and frees used resources.

public void close(IContext context) throws ApplicationException

  • context: IContext - (optional) a context to trace execution through a call chain.

isOpen

Checks if the component is open.

public boolean isOpen()

  • returns: boolean - True if the component is open and False otherwise.

open

Opens the component.

public void open(IContext context) throws ApplicationException

  • context: IContext - (optional) a context to trace execution through a call chain.

Static methods

fromTuples

Removes all component references that match the specified locator.

public static ManagedReferences fromTuples(Object… tuples) throws ReferenceException

  • tuples: Object… - locator to remove references by.
  • returns: ManagedReferences - list containing all removed references.

See also