Packageorg.spicefactory.parsley.core.messaging.impl
Classpublic class DefaultMessageReceiverCache
InheritanceDefaultMessageReceiverCache Inheritance Object
Implements MessageReceiverCache

A cached selection of receivers for a particular message type and its subtypes. Will be used by the default MessageRouter implementation as a performance optimization.



Public Methods
 MethodDefined By
  
DefaultMessageReceiverCache(type:ClassInfo, collections:Array)
Creates a new instance.
DefaultMessageReceiverCache
  
Checks whether the specified new collection matches the message type of this cache and adds it in that case.
DefaultMessageReceiverCache
  
getReceivers(kind:MessageReceiverKind, selector:*):Array
Returns the receivers for the specified receiver kind and selector value.
DefaultMessageReceiverCache
  
getSelectorValue(message:Object):*
Returns the value of the selector property of the specified message instance.
DefaultMessageReceiverCache
  
release():void
Releases this selection cache in case it is no longer used.
DefaultMessageReceiverCache
Constructor Detail
DefaultMessageReceiverCache()Constructor
public function DefaultMessageReceiverCache(type:ClassInfo, collections:Array)

Creates a new instance.

Parameters
type:ClassInfo — the type of the message
 
collections:Array — the collections of receivers applicable for this message type and its subtypes
Method Detail
checkNewCollection()method
public function checkNewCollection(collection:MessageReceiverCollection):void

Checks whether the specified new collection matches the message type of this cache and adds it in that case.

Parameters

collection:MessageReceiverCollection — the new collection to check

getReceivers()method 
public function getReceivers(kind:MessageReceiverKind, selector:*):Array

Returns the receivers for the specified receiver kind and selector value.

Parameters

kind:MessageReceiverKind — the kind of receivers to return
 
selector:* (default = NaN) — the selector to use for finding matching receivers

Returns
Array — the receivers for the specified receiver kind and messag
getSelectorValue()method 
public function getSelectorValue(message:Object):*

Returns the value of the selector property of the specified message instance.

Parameters

message:Object — the message instance

Returns
* — the value of the selector property of the specified message instance
release()method 
public function release():void

Releases this selection cache in case it is no longer used. Usually only called by the framework when there is no Context left that uses the ApplicationDomain the message type of this cache belongs to.