Packagecom.bourre.core
Classpublic class TypedFactoryLocator
InheritanceTypedFactoryLocator Inheritance AbstractLocator

Player version: Flash Player 9.0
Language version: ActionScript 3.0

The TypedFactoryLocator locator allow to store Class resource.


Example
  
  var locator : TypedFactoryLocator = new TypedFactoryLocator( Plugin );
  locator.register( "abstract", AbstractPlugin ); //return true
  locator.register( "custom", MyPlugin ); //return true
  locator.register( "sprite", Sprite ); //throw IllegalArgumentException and return false
  



Protected Properties
 PropertyDefined by
 Inherited_m : HashMap
Map storing String keys associated with Object values.
AbstractLocator
Public Methods
 MethodDefined by
  
TypedFactoryLocator(type:Class)
Creates new TypedFactoryLocator instance.
TypedFactoryLocator
 Inherited
add(d:Dictionary):void
Adds all ressources contained in the passed-in dictionnary into this locator instance.
AbstractLocator
 Inherited
addEventListener(type:String, listener:Object, ... rest):Boolean
Adds an event listener for the specified event type.
AbstractLocator
  
build(key:String):Object
Builds and returns new instance using Class registered with passed-in key in locator.
TypedFactoryLocator
 Inherited
callMethodOnAllValues(methodName:String, ... args):void
Takes all values of a Locator and call on each value the method name passed as 1st argument.
AbstractLocator
 Inherited
getKeys():Array
Returns an Array view of the keys contained in this locator.
AbstractLocator
 Inherited
Returns the exclusive logger object owned by this locator.
AbstractLocator
 Inherited
getType():Class
Return the class type of elements in this container.
AbstractLocator
 Inherited
getValues():Array
Returns an Array view of the values contained in this locator.
AbstractLocator
 Inherited
isRegistered(name:String):Boolean
Returns true is there is a ressource associated with the passed-in key.
AbstractLocator
 Inherited
isTyped():Boolean
Returns true if this container perform a verification of the type of elements.
AbstractLocator
 Inherited
locate(name:String):Object
Returns the ressource associated with the passed-in key.
AbstractLocator
 Inherited
matchType(o:*):Boolean
Verify that the passed-in object type match the current container element's type.
AbstractLocator
 Inherited
processOnAllValues(f:Function, ... args):void
Takes all values of a Locator and pass them one by one as arguments to a method of an object.
AbstractLocator
  
register(key:String, o:Object):Boolean
Registers passed-in object with identifier name to this locator.
TypedFactoryLocator
 Inherited
release():void
Clears all association between keys and objects registered for this locator.
AbstractLocator
 Inherited
removeEventListener(type:String, listener:Object):Boolean
Removes the passed-in listener for listening the specified event.
AbstractLocator
 Inherited
toString():String
Returns the string representation of this instance.
AbstractLocator
 Inherited
unregister(name:String):Boolean
Unregisters object registered with identifier name.
AbstractLocator
Protected Methods
 MethodDefined by
 Inherited
broadcastEvent(e:Event):void
Broadcast the passed-in event object to listeners according to the event's type.
AbstractLocator
 Inherited
Returns event Broadcaster owned by this locator.
AbstractLocator
 Inherited
onRegister(name:String = null, o:Object = null):void
Call this method to do something when an object is registered in locator.
AbstractLocator
 Inherited
onUnregister(name:String = null):void
Call this method to do something when an object is unregistered from locator.
AbstractLocator
Constructor detail
TypedFactoryLocator()constructor
public function TypedFactoryLocator(type:Class)

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Creates new TypedFactoryLocator instance.

Parameters
type:Class — Class type to store in this locator.
Method detail
build()method
public function build(key:String):Object

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Builds and returns new instance using Class registered with passed-in key in locator.

Parameters
key:String — Class registration identifier

Returns
Object — A new instance of registered Class

Throws
NoSuchElementException — There is no Class associated with the passed-in key
register()method 
public override function register(key:String, o:Object):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Registers passed-in object with identifier name to this locator.

As this locator is typed, object to store must extends ( or implements for interface case ), the class type of this locator.

Parameters
key:String — Key identifier
 
o:Object — Object to store

Returns
Booleantrue if success

Throws
IllegalArgumentException — Key or object are already defined in this locator.

Example
   
   var locator : TypedFactoryLocator = new TypedFactoryLocator( Plugin );
   locator.register( "abstract", AbstractPlugin ); //return true
   locator.register( "custom", MyPlugin ); //return true
   locator.register( "sprite", Sprite ); //throw IllegalArgumentException and return false