Packagecom.soma.core.interfaces
Interfacepublic interface ISomaInjector
Implementors SomaInjector

Author: Romuald Quantin - www.soundstep.com

Resources: http://www.soundstep.com/downloads/somacore

Actionscript version: 3.0

Copyright: Mozilla Public License 1.1 (MPL 1.1) http://www.opensource.org/licenses/mozilla1.1.php

The ISomaInjector interface exposes the injection methods used by the framework.

See also

com.soma.core.di.SomaInjector


Public Properties
 PropertyDefined By
  applicationDomain : ApplicationDomain
ApplicationDomain in use in the injector.
ISomaInjector
Public Methods
 MethodDefined By
  
Creates a child injector.
ISomaInjector
  
createInstance(classTarget:Class):Object
Instantiates a new instance from a given class.
ISomaInjector
  
dispose():void
Destroys the injector elements.
ISomaInjector
  
getInstance(classTarget:Class, name:String):Object
Retrieves or instantiates an instance of the given Class.
ISomaInjector
  
Retrieves the injector parent if any.
ISomaInjector
  
hasMapping(classTarget:Class, name:String):Boolean
Indicates wether a mapping rule exists for the given Class.
ISomaInjector
  
injectInto(instance:Object):void
Performs injection into the given instance.
ISomaInjector
  
map(whenAskFor:Class, createClass:Class, name:String):void
Rule that defines the "whenAskFor" to be injected with an instance of the "createClass" Class.
ISomaInjector
  
mapSingleton(classTarget:Class, name:String):void
Rule that defines the "classTarget" to be injected with always the same instance.
ISomaInjector
  
mapSingletonOf(whenAskFor:Class, useSingletonOf:Class, name:String):void
Rule that defines the "whenAskFor" (usually an interface) to be injected with the same instance "useSingletonOf".
ISomaInjector
  
mapToInstance(whenAskFor:Class, instance:Object, name:String):void
Rule that defines the "whenAskFor" to be injected the given instance.
ISomaInjector
  
removeMapping(classTarget:Class, name:String):void
Removes a mapping rule exists for the given Class.
ISomaInjector
Property Detail
applicationDomainproperty
applicationDomain:ApplicationDomain

ApplicationDomain in use in the injector.


Implementation
    public function get applicationDomain():ApplicationDomain
    public function set applicationDomain(value:ApplicationDomain):void
Method Detail
createChildInjector()method
public function createChildInjector():ISomaInjector

Creates a child injector. The child injector inherits the rules of its parents.

Returns
ISomaInjector — A ISomaInjector instance.
createInstance()method 
public function createInstance(classTarget:Class):Object

Instantiates a new instance from a given class. This method will always creates a new instance, regardless of any singleton mapping.

Parameters

classTarget:Class — A Class.

Returns
Object — An instance of the Class target.
dispose()method 
public function dispose():void

Destroys the injector elements.

getInstance()method 
public function getInstance(classTarget:Class, name:String):Object

Retrieves or instantiates an instance of the given Class. This method needs a mapping rule, the instance can be a singleton or a new one.

Parameters

classTarget:Class — A Class.
 
name:String — Injection name.

Returns
Object — An instance of the Class target.
getParentInjector()method 
public function getParentInjector():ISomaInjector

Retrieves the injector parent if any.

Returns
ISomaInjector — A ISomaInjector instance.
hasMapping()method 
public function hasMapping(classTarget:Class, name:String):Boolean

Indicates wether a mapping rule exists for the given Class.

Parameters

classTarget:Class — A Class.
 
name:String — Injection name.

Returns
Boolean — A Boolean.
injectInto()method 
public function injectInto(instance:Object):void

Performs injection into the given instance.

Parameters

instance:Object — An instance.

map()method 
public function map(whenAskFor:Class, createClass:Class, name:String):void

Rule that defines the "whenAskFor" to be injected with an instance of the "createClass" Class.

Parameters

whenAskFor:Class — A Class.
 
createClass:Class — A class.
 
name:String — Injection name.

mapSingleton()method 
public function mapSingleton(classTarget:Class, name:String):void

Rule that defines the "classTarget" to be injected with always the same instance.

Parameters

classTarget:Class — A Class.
 
name:String — Injection name.

mapSingletonOf()method 
public function mapSingletonOf(whenAskFor:Class, useSingletonOf:Class, name:String):void

Rule that defines the "whenAskFor" (usually an interface) to be injected with the same instance "useSingletonOf".

Parameters

whenAskFor:Class — A Class.
 
useSingletonOf:Class — A class.
 
name:String — Injection name.

mapToInstance()method 
public function mapToInstance(whenAskFor:Class, instance:Object, name:String):void

Rule that defines the "whenAskFor" to be injected the given instance.

Parameters

whenAskFor:Class — A Class.
 
instance:Object — An instance.
 
name:String — Injection name.

removeMapping()method 
public function removeMapping(classTarget:Class, name:String):void

Removes a mapping rule exists for the given Class.

Parameters

classTarget:Class — A Class.
 
name:String — Injection name.