| Package | andromeda.ioc.core |
| Class | public class ObjectDefinition |
| Inheritance | ObjectDefinition CoreObject |
| Implements | IObjectDefinition |
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
| Property | Defined 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 | ||
| Method | Defined by | ||
|---|---|---|---|
|
ObjectDefinition(id:*, type:String, singleton:Boolean = false, lazyInit:Boolean = false)
Creates a new ObjectDefinition instance.
| ObjectDefinition | ||
|
create(o:*):ObjectDefinition
[static]
Creates a new ObjectDefinition instance and populated it with the specified init object in argument.
| 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 | ||
|
getListeners():Array
Returns the Array of all listener definitions of this definition.
| ObjectDefinition | ||
![]() |
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 | ||
![]() |
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 | ||
|
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 Definition.
| ObjectDefinition | ||
![]() |
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 | ||
![]() |
toSource(indent:int = 0):String
Returns the string representation the source code of the object.
| CoreObject | |
![]() |
toString():String
Returns the string representation of this instance.
| CoreObject | |
| id | property |
id:* [read-write](read-write) Indicates the id of this object.
Implementation public function get id():*
public function set id(value:*):void
| identify | property |
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
| lock | property |
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
| 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.
|
| create | () | method |
public static function create(o:*):ObjectDefinitionCreates a new ObjectDefinition instance and populated it with the specified init object in argument.
Parameterso:* — A generic object to populate the new ObjectDefinition instance.
|
ObjectDefinition —
A ObjectDefinition instance.
|
| 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.
|
| getListeners | () | method |
public function getListeners():ArrayReturns the Array of all listener definitions of this definition.
ReturnsArray — the Array of all listener definitions of this definition.
|
| 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.
Parametersvalue: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 :
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.
Parametersvalue: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.
Parametersvalue:IObjectFactoryStrategy |
| setGenerates | () | method |
public function setGenerates(ar:Array):voidSets 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):voidInit the name of the method.
Parametersvalue: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 Definition.
Parametersar: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.
Parametersar:Array (default = null) — the Array of all properties of the object.
|
| setScope | () | method |
public function setScope(scope:String = null):voidSets the scope of the object.
Parametersscope:String (default = null) |
| setType | () | method |
public function setType(value:String = null):voidSets the type of the object (the class name).
Parametersvalue:String (default = null) — the string representation of the type object.
|