Packagesystem.ioc
Classpublic class ObjectDefinition
InheritanceObjectDefinition Inheritance Object
Implements IObjectDefinition

The concrete implementation of the IObjectDefinition interface.

Example :

     import flash.text.TextField ;
     import flash.text.TextFormat ;
     
     import system.ioc.ObjectDefinition ;
     
     var context:Object =
     {
         id         : "my_field" ,
         type       : "flash.text.TextField" ,
         properties :
         [
             { name : "defaultTextFormat" , value : new TextFormat("verdana", 11) } ,
             { name : "selectable"        , value : false                         } ,
             { name : "text"              , value : "hello world"                 } ,
             { name : "textColor"         , value : 0xF7F744                      } ,
             { name : "x"                 , value : 100                           } ,
             { name : "y"                 , value : 100                           }
         ]
     }
     
     var definition:ObjectDefinition = ObjectDefinition.create( context ) ;
     
     trace(definition.id + " : " + definition.getType()) ; // my_field : flash.text.TextField
     



Public Properties
 PropertyDefined By
  id : *
Indicates the id of this object.
ObjectDefinition
  identify : *
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.
ObjectDefinition
  lock : *
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.
ObjectDefinition
Public Methods
 MethodDefined By
  
ObjectDefinition(id:*, type:String, singleton:Boolean = false, lazyInit:Boolean = false)
Creates a new ObjectDefinition instance.
ObjectDefinition
  
Returns the Array of all listener definitions of this object definition register after the object initialization.
ObjectDefinition
  
Returns the Array of all receiver definitions of this object definition register after the object initialization.
ObjectDefinition
  
Returns the Array of all listener definitions of this object definition register before the object initialization.
ObjectDefinition
  
Returns the Array of all receiver definitions of this object definition register before the object initialization.
ObjectDefinition
  
Returns the constructor arguments values of this object in a Array list.
ObjectDefinition
  
getDependsOn():Array
Returns the collection (Array) defines in the "dependsOn" attribute.
ObjectDefinition
  
Returns the name of the method invoked when the object is destroyed.
ObjectDefinition
  
Returns the factory stategy of this definition to create the object.
ObjectDefinition
  
getGenerates():Array
Returns the collection (Array) defines in the "generates" attribute.
ObjectDefinition
  
Returns the name of the method call when the object is instanciate.
ObjectDefinition
  
Returns the Array of all properties of this Definition.
ObjectDefinition
  
getScope():String
Returns the scope of the object.
ObjectDefinition
  
getType():String
Returns the type of the object (the class name).
ObjectDefinition
  
isLazyInit():Boolean
Indicates if the object lazily initialized.
ObjectDefinition
  
isSingleton():Boolean
Returns true if the object in a Sigleton else the object is a prototype.
ObjectDefinition
  
setConstructorArguments(value:Array = null):void
Sets the constructor arguments values of this object.
ObjectDefinition
  
setDependsOn(ar:Array):void
Sets the collection (Array) defines in the "dependsOn" attribute.
ObjectDefinition
  
setDestroyMethodName(value:String = null):void
Sets the name of the method invoked when the object is destroyed.
ObjectDefinition
  
Sets the factory stategy of this definition to create the object.
ObjectDefinition
  
setGenerates(ar:Array):void
Sets the collection (Array) defines in the "generates" attribute.
ObjectDefinition
  
setInitMethodName(value:String = null):void
Init the name of the method.
ObjectDefinition
  
setListeners(ar:Array = null):void
Sets the Array of all listener definition of this object definition.
ObjectDefinition
  
setProperties(ar:Array = null):void
Sets the Array of all properties of this definition.
ObjectDefinition
  
setReceivers(ar:Array = null):void
Sets the Array of all receiver definition of this object definition.
ObjectDefinition
  
setScope(scope:String = null):void
Sets the scope of the object.
ObjectDefinition
  
setType(value:String = null):void
Sets the type of the object (the class name).
ObjectDefinition
Public Constants
 ConstantDefined By
  create : Function
[static] Creates a new ObjectDefinition instance and populated it with the specified init object in argument.
ObjectDefinition
Property Detail
idproperty
id:*

Indicates the id of this object.


Implementation
    public function get id():*
    public function set id(value:any):void
identifyproperty 
identify:*

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.


Implementation
    public function get identify():*
    public function set identify(value:any):void
lockproperty 
lock:*

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.


Implementation
    public function get lock():*
    public function set lock(value:any):void
Constructor Detail
ObjectDefinition()Constructor
public function ObjectDefinition(id:*, type:String, singleton:Boolean = false, lazyInit:Boolean = false)

Creates a new ObjectDefinition instance.

Parameters
id:* — the id of the ObjectDefinition object.
 
type:String — the type of the ObjectDefinition object.
 
singleton:Boolean (default = false) — the boolean flag to indicate if the object is a sigleton or not.
 
lazyInit:Boolean (default = false) — the boolean flag to indicate if the singleton object is lazy init or not.
Method Detail
getAfterListeners()method
public function getAfterListeners():Array

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

Returns
Array — the Array of all listener definitions of this object definition register after the object initialization.
getAfterReceivers()method 
public function getAfterReceivers():Array

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

Returns
Array — the Array of all receiver definitions of this object definition register after the object initialization.
getBeforeListeners()method 
public function getBeforeListeners():Array

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

Returns
Array — the Array of all listener definitions of this object definition register before the object initialization.
getBeforeReceivers()method 
public function getBeforeReceivers():Array

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

Returns
Array — the Array of all receiver definitions of this object definition register before the object initialization.
getConstructorArguments()method 
public function getConstructorArguments():Array

Returns the constructor arguments values of this object in a Array list.

Returns
Array — the constructor arguments values of this object in a Array list.
getDependsOn()method 
public function getDependsOn():Array

Returns the collection (Array) defines in the "dependsOn" attribute.

Returns
Array — the collection (Array) defines in the "dependsOn" attribute.
getDestroyMethodName()method 
public function getDestroyMethodName():String

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

Returns
String — the name of the method invoked when the object is destroyed.
getFactoryStrategy()method 
public function getFactoryStrategy():IObjectFactoryStrategy

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

Returns
IObjectFactoryStrategy — the factory stategy of this definition to create the object.
getGenerates()method 
public function getGenerates():Array

Returns the collection (Array) defines in the "generates" attribute.

Returns
Array — the collection (Array) defines in the "generates" attribute.
getInitMethodName()method 
public function getInitMethodName():String

Returns the name of the method call when the object is instanciate.

Returns
String — the name of the method call when the object is instanciate.
getProperties()method 
public function getProperties():Array

Returns the Array of all properties of this Definition.

Returns
Array — the Array of all properties of this Definition.
getScope()method 
public function getScope():String

Returns the scope of the object.

Returns
String — the scope of the object.
getType()method 
public function getType():String

Returns the type of the object (the class name).

Returns
String — the type of the object (the class name).
isLazyInit()method 
public function isLazyInit():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.

Returns
Boolean — A boolean who indicates if the object lazily initialized.
isSingleton()method 
public function isSingleton():Boolean

Returns true if the object in a Sigleton else the object is a prototype.

Returns
Booleantrue if the object in a Sigleton else the object is a prototype.
setConstructorArguments()method 
public function setConstructorArguments(value:Array = null):void

Sets the constructor arguments values of this object.

Parameters

value:Array (default = null) — the array representation of all arguments in the constructor of the object instance.

setDependsOn()method 
public function setDependsOn(ar:Array):void

Sets the collection (Array) defines in the "dependsOn" attribute.

Example :

         import system.ioc.ObjectDefinition ;
         
         var init:Object =
         {
             id   : "my_field" ,
             type : "flash.text.TextField" ,
         }
         
         var definition:ObjectDefinition = ObjectDefinition.create( init ) ;
         
         definition.setDependsOn( [2,3,4,5, "hello"] ) ;
         trace( definition.getDependsOn() ) ; // "hello"
         
         definition.setDependsOn( [2,3,4,5] ) ;
         trace( definition.getDependsOn() ) ; // 'empty Array'
         
         definition.setDependsOn( [] ) ;
         trace( definition.getDependsOn() ) ; // null
         
         definition.setDependsOn( null ) ;
         trace( definition.getDependsOn() ) ; // null
         

Parameters

ar:Array

setDestroyMethodName()method 
public function setDestroyMethodName(value:String = null):void

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

Parameters

value:String (default = null) — the name of the destroy method of the object.

setFactoryStrategy()method 
public function setFactoryStrategy(value:IObjectFactoryStrategy):void

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

Parameters

value:IObjectFactoryStrategy

setGenerates()method 
public function setGenerates(ar:Array):void

Sets the collection (Array) defines in the "generates" attribute.

Example :

         import system.ioc.ObjectDefinition ;
         
         var init:Object =
         {
             id   : "my_field" ,
             type : "flash.text.TextField" ,
         }
         
         var definition:ObjectDefinition = ObjectDefinition.create( init ) ;
         
         definition.setGenerates( [2,3,4,5, "hello"] ) ;
         trace( definition.getGenerates() ) ; // "hello"
         
         definition.setGenerates( [2,3,4,5] ) ;
         trace( definition.getGenerates() ) ; // 'empty Array'
         
         definition.setGenerates( [] ) ;
         trace( definition.getGenerates() ) ; // null
         
         definition.setGenerates( null ) ;
         trace( definition.getGenerates() ) ; // null
         

Parameters

ar:Array

setInitMethodName()method 
public function setInitMethodName(value:String = null):void

Init the name of the method.

Parameters

value:String (default = null) — the string 'init method' name.

setListeners()method 
public function setListeners(ar:Array = null):void

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

Parameters

ar:Array (default = null) — the Array of all listener definitions of the object.

setProperties()method 
public function setProperties(ar:Array = null):void

Sets the Array of all properties of this definition.

Parameters

ar:Array (default = null) — the Array of all properties of the object.

setReceivers()method 
public function setReceivers(ar:Array = null):void

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

Parameters

ar:Array (default = null) — the Array of all receiver definitions of the object.

setScope()method 
public function setScope(scope:String = null):void

Sets the scope of the object.

Parameters

scope:String (default = null)

setType()method 
public function setType(value:String = null):void

Sets the type of the object (the class name).

Parameters

value:String (default = null) — the string representation of the type object.

Constant Detail
createConstant
public static const create:Function

Creates a new ObjectDefinition instance and populated it with the specified init object in argument.