Packagecom.bourre.core
Interfacepublic interface Locator
ImplementorsAbstractLocator, BeanFactory, ServiceProxyLocator

Player version: Flash Player 9.0
Language version: ActionScript 3.0

A Locator is an entity that points to specific kind of ressources within an application. All ressources stored by a locator is identified with a unique key.

All concret locators implementations are associated with a specific types of ressources. For example, the GraphicLoaderLocator allow a single access point for all swf files loaded by an application.



Public Methods
 MethodDefined by
  
add(d:Dictionary):void
Adds all ressources contained in the passed-in dictionnary into this locator instance.
Locator
  
getKeys():Array
Returns an Array view of the keys contained in this locator.
Locator
  
getValues():Array
Returns an Array view of the values contained in this locator.
Locator
  
isRegistered(key:String):Boolean
Returns true is there is a ressource associated with the passed-in key.
Locator
  
locate(key:String):Object
Returns the ressource associated with the passed-in key.
Locator
Method detail
add()method
public function add(d:Dictionary):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Adds all ressources contained in the passed-in dictionnary into this locator instance. If there is keys used both in the locator and in the dictionnary an exception is thrown.

Parameters
d:Dictionary — dictionnary instance which contains ressources to be added

Throws
IllegalArgumentException — One or more keys present in the dictionnary already exist in this locator instance.
getKeys()method 
public function getKeys():Array

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns an Array view of the keys contained in this locator.

Returns
Array — an array view of the keys contained in this locator
getValues()method 
public function getValues():Array

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns an Array view of the values contained in this locator.

Returns
Array — an array view of the values contained in this locator
isRegistered()method 
public function isRegistered(key:String):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns true is there is a ressource associated with the passed-in key. To avoid errors when retreiving ressources from a locator you should systematically use the isRegistered function to check if the ressource you would access is already accessible before any call to the locate function.

Parameters
key:String

Returns
Booleantrue is there is a ressource associated with the passed-in key.
locate()method 
public function locate(key:String):Object

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns the ressource associated with the passed-in key. If there is no ressource identified by the passed-in key, the function will fail with an error. To avoid the throw of an exception when attempting to access to a ressource, take care to check the existence of the ressource before trying to access to it.

Parameters
key:String — identifier of the ressource to access

Returns
Object — the ressource associated with the passed-in key

Throws
NoSuchElementException — There is no ressource associated with the passed-in key