| Package | system.ioc |
| Class | public class ObjectDefinition |
| Inheritance | ObjectDefinition Object |
| Implements | IObjectDefinition |
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
| Property | Defined 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 | ||
| Method | Defined By | ||
|---|---|---|---|
ObjectDefinition(id:*, type:String, singleton:Boolean = false, lazyInit:Boolean = false)
Creates a new ObjectDefinition instance. | ObjectDefinition | ||
getAfterListeners():Array
Returns the Array of all listener definitions of this object definition register after the object initialization. | ObjectDefinition | ||
getAfterReceivers():Array
Returns the Array of all receiver definitions of this object definition register after the object initialization. | ObjectDefinition | ||
getBeforeListeners():Array
Returns the Array of all listener definitions of this object definition register before the object initialization. | ObjectDefinition | ||
getBeforeReceivers():Array
Returns the Array of all receiver definitions of this object definition register before the object initialization. | ObjectDefinition | ||
getConstructorArguments():Array
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 | ||
getDestroyMethodName():String
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 | ||
getInitMethodName():String
Returns the name of the method call when the object is instanciate. | ObjectDefinition | ||
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 | ||
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 | ||
setFactoryStrategy(value:IObjectFactoryStrategy):void
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 | ||
| Constant | Defined By | ||
|---|---|---|---|
| create : Function [static]
Creates a new ObjectDefinition instance and populated it with the specified init object in argument. | ObjectDefinition | ||
| id | property |
id:*Indicates the id of this object.
public function get id():* public function set id(value:any):void| identify | property |
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.
public function get identify():* public function set identify(value:any):void| lock | property |
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.
public function get lock():* public function set lock(value:any):void| ObjectDefinition | () | Constructor |
public function ObjectDefinition(id:*, type:String, singleton:Boolean = false, lazyInit:Boolean = false)Creates a new ObjectDefinition instance.
Parametersid:* — 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.
|
| getAfterListeners | () | method |
public function getAfterListeners():ArrayReturns the Array of all listener definitions of this object definition register after the object initialization.
ReturnsArray — the Array of all listener definitions of this object definition register after the object initialization.
|
| getAfterReceivers | () | method |
public function getAfterReceivers():ArrayReturns the Array of all receiver definitions of this object definition register after the object initialization.
ReturnsArray — the Array of all receiver definitions of this object definition register after the object initialization.
|
| getBeforeListeners | () | method |
public function getBeforeListeners():ArrayReturns the Array of all listener definitions of this object definition register before the object initialization.
ReturnsArray — the Array of all listener definitions of this object definition register before the object initialization.
|
| getBeforeReceivers | () | method |
public function getBeforeReceivers():ArrayReturns the Array of all receiver definitions of this object definition register before the object initialization.
ReturnsArray — the Array of all receiver definitions of this object definition register before the object initialization.
|
| getConstructorArguments | () | method |
public function getConstructorArguments():ArrayReturns the constructor arguments values of this object in a Array list.
ReturnsArray — the constructor arguments values of this object in a Array list.
|
| getDependsOn | () | method |
public function getDependsOn():ArrayReturns the collection (Array) defines in the "dependsOn" attribute.
ReturnsArray — the collection (Array) defines in the "dependsOn" attribute.
|
| getDestroyMethodName | () | method |
public function getDestroyMethodName():StringReturns the name of the method invoked when the object is destroyed.
ReturnsString — the name of the method invoked when the object is destroyed.
|
| getFactoryStrategy | () | method |
public function getFactoryStrategy():IObjectFactoryStrategyReturns the factory stategy of this definition to create the object.
ReturnsIObjectFactoryStrategy — the factory stategy of this definition to create the object.
|
| getGenerates | () | method |
public function getGenerates():ArrayReturns the collection (Array) defines in the "generates" attribute.
ReturnsArray — the collection (Array) defines in the "generates" attribute.
|
| getInitMethodName | () | method |
public function getInitMethodName():StringReturns the name of the method call when the object is instanciate.
ReturnsString — the name of the method call when the object is instanciate.
|
| getProperties | () | method |
public function getProperties():ArrayReturns the Array of all properties of this Definition.
ReturnsArray — the Array of all properties of this Definition.
|
| getScope | () | method |
public function getScope():StringReturns the scope of the object.
ReturnsString — the scope of the object.
|
| getType | () | method |
public function getType():StringReturns the type of the object (the class name).
ReturnsString — the type of the object (the class name).
|
| isLazyInit | () | method |
public function isLazyInit():BooleanIndicates 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.
ReturnsBoolean — 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.
Boolean — true if the object in a Sigleton else the object is a prototype.
|
| setConstructorArguments | () | method |
public function setConstructorArguments(value:Array = null):voidSets 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):voidSets 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):voidSets 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):voidSets the factory stategy of this definition to create the object.
Parameters
value:IObjectFactoryStrategy |
| setGenerates | () | method |
public function setGenerates(ar:Array):voidSets 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):voidInit the name of the method.
Parameters
value:String (default = null) — the string 'init method' name.
|
| setListeners | () | method |
public function setListeners(ar:Array = null):voidSets 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):voidSets 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):voidSets 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):voidSets the scope of the object.
Parameters
scope:String (default = null) |
| setType | () | method |
public function setType(value:String = null):voidSets the type of the object (the class name).
Parameters
value:String (default = null) — the string representation of the type object.
|
| create | Constant |
public static const create:FunctionCreates a new ObjectDefinition instance and populated it with the specified init object in argument.