klyn.di.DIContext.getComponent
method
public getComponent(name as String) as Object:
Description

Returns a registered component by name.

Parameters
ParameterDescription
nameComponent name.
Returns

The registered component instance.

Throws
  • ComponentNotFoundException if no component is registered under the requested name.
Example
import klyn.di

context = DIContext()
service = Object()
context.registerComponent("service", service)
assert context.getComponent("service") == service