Packagemvcexpress.core
Classpublic class ProxyMap
InheritanceProxyMap Inheritance Object
Implements IProxyMap

ProxyMap is responsible for storing proxy objects and handling injection.



Protected Properties
 PropertyDefined By
  classConstRegistry : Dictionary
Dictionary with constants of inject names, used with constName, and constScope.
ProxyMap
  classInjectRules : Dictionary
[static] dictionary of (Vector of InjectRuleVO), stored by class names.
ProxyMap
  commandMap : CommandMap
ProxyMap
  injectObjectRegistry : Dictionary
all objects ready for injection stored by key.
ProxyMap
  lazyProxyRegistry : Dictionary
dictionary of lazy Proxies, those proxies will be instantiated and mapped on first use.
ProxyMap
  mediatorInjectIdRegistry : Dictionary
ProxyMap
  mediatorInjectObjectRegistry : Dictionary
ProxyMap
  messenger : Messenger
ProxyMap
  moduleName : String
ProxyMap
  pendingInjectionsRegistry : Dictionary
dictionary of (Vector of PendingInject), it holds array of pending data with proxies and mediators that has pending injections, stored by needed injection key(className + inject name).
ProxyMap
  qualifiedClassNameRegistry : Dictionary
[static] stores class QualifiedClassName by class
ProxyMap
Public Methods
 MethodDefined By
  
ProxyMap($moduleName:String, $messenger:Messenger)
CONSTRUCTOR
ProxyMap
  
getProxy(proxyClass:Class, name:String = null):Proxy
Get proxy by class.
ProxyMap
  
isMapped(injectClass:Class, name:String = null, proxyObject:Proxy = null):Boolean
Checks if proxy object is mapped using specified class(and optionally name.).
ProxyMap
  
lazyMap(proxyClass:Class, name:String = null, injectClass:Class = null, mediatorInjectClass:Class = null, proxyConstructorParams:Array = null):String
Stores lazy proxy data to be instantiated on first use.
ProxyMap
  
listMappings(verbose:Boolean = true):String
Returns text of all mapped proxy objects, and keys they are mapped to.
ProxyMap
  
map(proxyObject:Proxy, name:String = null, injectClass:Class = null, mediatorInjectClass:Class = null):String
Maps proxy object to injectClass and name.
ProxyMap
  
unmap(injectClass:Class, name:String = null):String
Removes proxy mapped for injection by injectClass and name.
ProxyMap
Property Detail
classConstRegistryproperty
protected var classConstRegistry:Dictionary

Dictionary with constants of inject names, used with constName, and constScope.

classInjectRulesproperty 
protected static var classInjectRules:Dictionary

dictionary of (Vector of InjectRuleVO), stored by class names.

commandMapproperty 
protected var commandMap:CommandMap

injectObjectRegistryproperty 
protected var injectObjectRegistry:Dictionary

all objects ready for injection stored by key. (className + inject name)

lazyProxyRegistryproperty 
protected var lazyProxyRegistry:Dictionary

dictionary of lazy Proxies, those proxies will be instantiated and mapped on first use.

mediatorInjectIdRegistryproperty 
protected var mediatorInjectIdRegistry:Dictionary

mediatorInjectObjectRegistryproperty 
protected var mediatorInjectObjectRegistry:Dictionary

messengerproperty 
protected var messenger:Messenger

moduleNameproperty 
protected var moduleName:String

pendingInjectionsRegistryproperty 
protected var pendingInjectionsRegistry:Dictionary

dictionary of (Vector of PendingInject), it holds array of pending data with proxies and mediators that has pending injections, stored by needed injection key(className + inject name).

qualifiedClassNameRegistryproperty 
protected static var qualifiedClassNameRegistry:Dictionary

stores class QualifiedClassName by class

Constructor Detail
ProxyMap()Constructor
public function ProxyMap($moduleName:String, $messenger:Messenger)

CONSTRUCTOR

Parameters
$moduleName:String
 
$messenger:Messenger
Method Detail
getProxy()method
public function getProxy(proxyClass:Class, name:String = null):Proxy

Get proxy by class. Alternative to injecting proxy automatically.

You might want to get proxy manually then your proxy has dynamic name. Also you might want to get proxy manually if your proxy is needed only in rare cases or only for short time. (for instance - you need it only in onRegister() function.)

Parameters

proxyClass:Class — class of proxy, proxy object is mapped to.
 
name:String (default = null) — Optional name if you need more then one proxy instance of same class.

Returns
Proxy
isMapped()method 
public function isMapped(injectClass:Class, name:String = null, proxyObject:Proxy = null):Boolean

Checks if proxy object is mapped using specified class(and optionally name.).

Optionally you can check if specific proxyObject is already mapped.

Parameters

injectClass:Class — Optional class to use for injection, if null proxyObject class is used. It is helpful if you want to map proxy interface or subclass.
 
name:String (default = null) — Optional name if you need more then one proxy instance of same class.
 
proxyObject:Proxy (default = null) — Proxy instance, to check if it's mapped.

Returns
Boolean — true if proxy is mapped
lazyMap()method 
public function lazyMap(proxyClass:Class, name:String = null, injectClass:Class = null, mediatorInjectClass:Class = null, proxyConstructorParams:Array = null):String

Stores lazy proxy data to be instantiated on first use. Proxy will be instantiated and mapped then requested for the first time.

Parameters

proxyClass:Class — Class to construct proxy.
 
name:String (default = null) — Optional name if you need more then one proxy instance of same class.
 
injectClass:Class (default = null) — Optional class to use for injection, if null proxyObject class is used. It is helpful if you want to map proxy interface or subclass.
 
mediatorInjectClass:Class (default = null) — parameters to pass to proxy constructor. (up to 10 parameters)
 
proxyConstructorParams:Array (default = null)

Returns
String — returns inject id. (for debugging reasons only.)
listMappings()method 
public function listMappings(verbose:Boolean = true):String

Returns text of all mapped proxy objects, and keys they are mapped to. (for debugging)

Parameters

verbose:Boolean (default = true) — if set to true, will return readable string, false will return pairs of object class name and key it is mapped to separated by '>', all pairs are separated by ';'.

Returns
String — Text string with all mapped proxies.
map()method 
public function map(proxyObject:Proxy, name:String = null, injectClass:Class = null, mediatorInjectClass:Class = null):String

Maps proxy object to injectClass and name.

Parameters

proxyObject:Proxy — Proxy instance to use for injection.
 
name:String (default = null) — Optional name if you need more then one proxy instance of same class.
 
injectClass:Class (default = null) — Optional class to use for injection, if null proxyObject class is used. It is helpful if you want to map proxy interface or subclass.
 
mediatorInjectClass:Class (default = null) — Optional class to use for injection in mediators, if null - injectClass class is used. If injectClass is null - proxyObject class is used.

Returns
String — returns inject id. (for debugging reasons only.)
mediatorIsProxyMapped()method 
pureLegsCore function mediatorIsProxyMapped(proxyClass:Class, name:String = null):Boolean

Function to check if proxy can be received from Mediator.

Parameters

proxyClass:Class
 
name:String (default = null)

Returns
Boolean
unmap()method 
public function unmap(injectClass:Class, name:String = null):String

Removes proxy mapped for injection by injectClass and name. If mapping does not exists - it will fail silently.

Parameters

injectClass:Class — class previously mapped for injection
 
name:String (default = null) — name added to class, that was previously mapped for injection

Returns
String — returns inject id. (for debugging reasons only.)