Packageandromeda.ioc.core
Classpublic class ObjectDefinition
InheritanceObjectDefinition Inheritance CoreObject
ImplementsIObjectDefinition

The concrete implementation of the IObjectDefinition interface.

Example :

     import flash.text.TextField ;
     import flash.text.TextFormat ;
     
     import andromeda.ioc.core.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 : *
(read-write) 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
  
[static] Creates a new ObjectDefinition instance and populated it with the specified init object in argument.
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
  
getListeners():Array
Returns the Array of all listener definitions of this definition.
ObjectDefinition
 Inherited
Returns the internal ILogger reference of this ILogable object.
CoreObject
  
getProperties():Array
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
 Inherited
hashCode():uint
Returns a hashcode value for the object.
CoreObject
  
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 Definition.
ObjectDefinition
 Inherited
setLogger(log:ILogger = null):void
Sets the internal ILogger reference of this ILogable object.
CoreObject
  
setProperties(ar:Array = null):void
Sets the Array of all properties of this 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
 Inherited
toSource(indent:int = 0):String
Returns the string representation the source code of the object.
CoreObject
 Inherited
toString():String
Returns the string representation of this instance.
CoreObject
Property detail
idproperty
id:*  [read-write]

(read-write) Indicates the id of this object.

Implementation
    public function get id():*
    public function set id(value:*):void
identifyproperty 
identify:*  [read-write]

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:*):void
lockproperty 
lock:*  [read-write]

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:*):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
create()method
public static function create(o:*):ObjectDefinition

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

Parameters
o:* — A generic object to populate the new ObjectDefinition instance.

Returns
ObjectDefinition — A ObjectDefinition instance.
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.
getListeners()method 
public function getListeners():Array

Returns the Array of all listener definitions of this definition.

Returns
Array — the Array of all listener definitions of this definition.
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 :

         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 :

         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 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.
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.