Class: ObjectDefinition

system.ioc. ObjectDefinition


new ObjectDefinition(id, type [, singleton] [, lazyInit] [, lazyType])

The objects that form the backbone of your application and that are managed by the IoC container are called object definitions. An object definition is an object that is instantiated, assembled, and otherwise managed by the IoC factory.

The object definition contains the information called configuration metadata which is needed for the container to know the followings :

  • How to create an object
  • Object's lifecycle details
  • Object's dependencies

Parameters:
Name Type Argument Default Description
id string

The unique index of the object definition register in the container.

type string | function

The type of the object (the function reference of the class name).

singleton boolean <optional>
false

Indicates if the object definition scope is 'singleton' or not.

lazyInit boolean <optional>
false

Indicates if the object definition scope is 'lazyInit' or not.

lazyType boolean <optional>
false

Indicates if the object definition check or not the type of the new object.

Implements:
Throws:

ReferenceError if the id and type arguments are null or undefined.

Extends

Members


<readonly> afterListeners :Array

The Array of all listener definitions of this object definition register after the object initialization.

Type:

<readonly> afterReceivers :Array

Returns the Array of all receiver definitions of this object definition register after the object initialization.

Type:

<readonly> beforeListeners :Array

Returns the Array of all listener definitions of this object definition register before the object initialization.

Type:

<readonly> beforeReceivers :Array

Returns the Array of all receiver definitions of this object definition register before the object initialization.

Type:

constructorArguments

The constructor arguments values of this object in a Array list.


dependsOn

Defines the "dependsOn" collection.


destroyMethodName

Determinates the name of the method invoked when the object is destroyed.


generates

Defines the "generates" collection.


id :string

Indicates the unique identifier value of this object.

Type:
  • string
Overrides:
Implements:

identify :boolean

Indicates if the object definition is a singleton and the type of the object is Identifiable if the object must be populated with the id of the definition when is instanciated.

Type:
  • boolean

initMethodName :string

Determinates the name of the method invoked when the object is created.

Type:
  • string

lazyInit :boolean

Indicates if the object lazily initialized. Only applicable to a singleton object. If false, it will get instantiated on startup by object factories that perform eager initialization of singletons.

Type:
  • boolean

lazyType :boolean

Indicates if the object lazily typed. If false, it will the object is instantiated without type checking.

Type:
  • boolean

listeners

Sets the Array of all receiver definition of this object definition.


lock :boolean

Indicates if the object definition lock this Lockable object during the population of the properties and the initialization of the methods defines in the object definition.

Type:
  • boolean

properties

Sets the Array representation of all properties of this definition.


receivers

Sets the Array of all receiver definition of this object definition.


scope

Determinates the scope of the object.


singleton :boolean

Indicates if the object in a singleton else the object is a prototype (read only, use the scope property to change it).

Type:
  • boolean

strategy

Determinates the factory stategy of this definition to create the object.


type

Indicates the type of the object (the function reference of the class name).

Methods


toString()

Returns the string representation of this instance.

Returns:

the string representation of this instance.