| Package | andromeda.ioc.core |
| Class | public class TypeAliases |
| Inheritance | TypeAliases CoreObject |
This helper is used in a ioc container (ObjectFactory) to map the type class of an object.
Example :
import andromeda.ioc.core.TypeAliases ;
import system.data.Iterator ;
var aliases:TypeAliases = new TypeAliases() ;
aliases.put( "DropShadowFilter" , "flash.filters.DropShadowFilter" ) ;
aliases.put( "CoreObject" , "vegas.core.CoreObject" ) ;
aliases.put( "ObjectFactory" , "andromeda.factory.ObjectFactory" ) ;
aliases.put( "vegas.HashMap" , "system.data.maps.HashMap" ) ; // can use custom alias
trace("-------- aliases.containsAlias('DropShadowFilter')") ;
trace( aliases.containsAlias('DropShadowFilter') ) ;
trace( aliases.containsAlias('noAlias') ) ;
trace("-------- aliases.containsValue()") ;
trace( aliases.containsValue('vegas.core.CoreObject') ) ;
trace( aliases.containsAlias('noValue') ) ;
trace("-------- aliases.getAliases()") ;
trace( aliases.getAliases() ) ;
trace("-------- aliases.getValue('CoreObject')") ;
trace( aliases.getValue("CoreObject") ) ;
trace("-------- aliases.getValues()") ;
trace( aliases.getValues() ) ;
trace("-------- iterator") ;
var it:Iterator = aliases.iterator() ;
while( it.hasNext() )
{
var next:String = it.next() as String ;
var key:String = it.key() as String ;
trace( aliases + " alias : '" + key + "' -> value : '" + next + "'" ) ;
}
trace("-------- clear and isEmpty") ;
trace( aliases.isEmpty() ) ;
aliases.clear() ;
trace( aliases.isEmpty() ) ;
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new TypeAliases instance.
| TypeAliases | ||
|
clear():void
Clear all alias in the internal map of this object.
| TypeAliases | ||
|
containsAlias(alias:String):Boolean
Indicates if the collector contains the passed-in alias expression.
| TypeAliases | ||
|
containsValue(value:String):Boolean
Indicates if the collector contains the passed-in type value expression.
| TypeAliases | ||
|
getAliases():Array
Returns the Array representation of all aliases registered in this collector.
| TypeAliases | ||
![]() |
Returns the internal
ILogger reference of this ILogable object. | CoreObject | |
|
Returns the internal Map reference of this collector.
| TypeAliases | ||
|
getValue(alias:String):String
Returns the value of the specified alias.
| TypeAliases | ||
|
getValues():Array
Returns the
Array representation of all type values registered in this collector. | TypeAliases | ||
![]() |
hashCode():uint
Returns a hashcode value for the object.
| CoreObject | |
|
isEmpty():Boolean
Returns
true if the collector is empty. | TypeAliases | ||
|
Returns the
Iterator of the object. | TypeAliases | ||
|
put(alias:String, value:String):Boolean
Inserts an alias in the collector.
| TypeAliases | ||
![]() |
Sets the internal
ILogger reference of this ILogable object. | CoreObject | |
|
size():uint
Returns the number of alias registered in the collector.
| TypeAliases | ||
![]() |
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 | |
| TypeAliases | () | constructor |
public function TypeAliases()Creates a new TypeAliases instance.
| clear | () | method |
public function clear():voidClear all alias in the internal map of this object.
| containsAlias | () | method |
public function containsAlias(alias:String):BooleanIndicates if the collector contains the passed-in alias expression.
Parametersalias:String |
Boolean — true if the collector contains the passed-in alias expression.
|
| containsValue | () | method |
public function containsValue(value:String):BooleanIndicates if the collector contains the passed-in type value expression.
Parametersvalue:String |
Boolean — true if the collector contains the passed-in type value expression.
|
| getAliases | () | method |
public function getAliases():ArrayReturns the Array representation of all aliases registered in this collector.
import andromeda.ioc.core.TypeAliases ;
var aliases:TypeAliases = new TypeAliases() ;
aliases.put( "DropShadowFilter" , "flash.filters.DropShadowFilter" ) ;
aliases.put( "CoreObject" , "vegas.core.CoreObject" ) ;
trace( aliases.getAliases() ) ; // DropShadowFilter,CoreObject
Returns
Array — the Array representation of all aliases registered in this collector.
|
| getMap | () | method |
public function getMap():MapReturns the internal Map reference of this collector.
ReturnsMap —
the internal Map reference of this collector.
|
| getValue | () | method |
public function getValue(alias:String):StringReturns the value of the specified alias.
Example :
import andromeda.ioc.core.TypeAliases ;
var aliases:TypeAliases = new TypeAliases() ;
aliases.put( "CoreObject" , "vegas.core.CoreObject" ) ;
trace( aliases.getValue("CoreObject") ) ; // vegas.core.CoreObject
Parameters
alias:String |
String — the value of the specified alias.
|
| getValues | () | method |
public function getValues():Array
Returns the Array representation of all type values registered in this collector.
Example :
import andromeda.ioc.core.TypeAliases ;
var aliases:TypeAliases = new TypeAliases() ;
aliases.put( "DropShadowFilter" , "flash.filters.DropShadowFilter" ) ;
aliases.put( "CoreObject" , "vegas.core.CoreObject" ) ;
trace( aliases.getValues() ) ; // flash.filters.DropShadowFilter,vegas.core.CoreObject
Returns
Array — the Array representation of all type values registered in this collector.
|
| isEmpty | () | method |
public function isEmpty():Boolean
Returns true if the collector is empty.
Boolean — true if the collector is empty.
|
| iterator | () | method |
public function iterator():Iterator
Returns the Iterator of the object.
Example :
import andromeda.ioc.core.TypeAliases ;
import system.data.Iterator ;
var aliases:TypeAliases = new TypeAliases() ;
aliases.put( "DropShadowFilter" , "flash.filters.DropShadowFilter" ) ;
aliases.put( "CoreObject" , "vegas.core.CoreObject" ) ;
aliases.put( "ObjectFactory" , "andromeda.factory.ObjectFactory" ) ;
aliases.put( "vegas.HashMap" , "system.data.maps.HashMap" ) ; // can use custom alias
var it:Iterator = aliases.iterator() ;
while( it.hasNext() )
{
var next:String = it.next() as String ;
var key:String = it.key() as String ;
trace( aliases + " alias : '" + key + "' -> value : '" + next + "'" ) ;
}
Returns
Iterator —
the Iterator of the object.
|
| put | () | method |
public function put(alias:String, value:String):BooleanInserts an alias in the collector. If the alias already exist the value in the collector is replaced.
Example
import andromeda.ioc.core.TypeAliases ;
var aliases:TypeAliases = new TypeAliases() ;
aliases.put( "DropShadowFilter" , "flash.filters.DropShadowFilter" ) ;
aliases.put( "CoreObject" , "vegas.core.CoreObject" ) ;
aliases.put( "ObjectFactory" , "andromeda.factory.ObjectFactory" ) ;
aliases.put( "vegas.HashMap" , "system.data.maps.HashMap" ) ; // can use custom alias
Parameters
alias:String — The alias name, this expression not must be null and not empty or the method return false.
|
|
value:String — The value of the alias type, this expression not must be null and not empty or the method return false.
|
Boolean — true if the alias can be registered.
|
| size | () | method |
public function size():uintReturns the number of alias registered in the collector.
Returnsuint — the number of alias registered in the collector.
|