Packagech.capi.core
Classpublic final class ApplicationContext

Represents a context for the ApplicationFile.

See also

ApplicationFile


Public Methods
 MethodDefined by
  
Creates a new ApplicationContext object.
ApplicationContext
  
Add the specified ApplicationFile to the current ApplicationContext.
ApplicationContext
  
clear():void
Clear all the ApplicationFile of the ApplicationContext.
ApplicationContext
  
[static] Enumerates all ApplicationContext instances.
ApplicationContext
  
enumerateFiles(globalOnly:Boolean = false):Array
Enumerates all the ApplicationFile contained into the ApplicationContext.
ApplicationContext
  
getFile(name:String):ApplicationFile
Get the ApplicationFile linked to the specified name.
ApplicationContext
  
[static] Retrieves the global ApplicationContext.
ApplicationContext
  
removeFile(file:ApplicationFile, recursiveRemoval:Boolean = false):void
Remove the specified ApplicationFile from the ApplicationContext.
ApplicationContext
Constructor detail
ApplicationContext()constructor
public function ApplicationContext()

Creates a new ApplicationContext object.

Method detail
addFile()method
public function addFile(file:ApplicationFile):void

Add the specified ApplicationFile to the current ApplicationContext. If the context of the ApplicationFile is already specified, this method will throw an error.

This method will also check that all dependencies of the specified ApplicationFile are already into the current ApplicationContext. If they are in no ApplicationContext they will be added into the current one, otherwise an error will be thrown.

Parameters
file:ApplicationFile — The ApplicationFile.

Throws
— If the ApplicationContext of the file is not null.
 
— If one of the dependencies is in another ApplicationContext.
 
— If the name of the ApplicationFile is already taken.
clear()method 
public function clear():void

Clear all the ApplicationFile of the ApplicationContext. The context property of the ApplicationFile instances are reset to null to let the Garbate Collector take care of the ApplicationContext instance.

enumerateContexts()method 
public static function enumerateContexts():Array

Enumerates all ApplicationContext instances.

Returns
Array — An Array containing all ApplicationContext.
enumerateFiles()method 
public function enumerateFiles(globalOnly:Boolean = false):Array

Enumerates all the ApplicationFile contained into the ApplicationContext.

Parameters
globalOnly:Boolean (default = false) — Defines if only the global files or all the files must be listed.

Returns
Array — An Array containing the enumerated ApplicationFile.
getFile()method 
public function getFile(name:String):ApplicationFile

Get the ApplicationFile linked to the specified name.

Parameters
name:String

Returns
ApplicationFile — The ApplicationFile or null.
getGlobalContext()method 
public static function getGlobalContext():ApplicationContext

Retrieves the global ApplicationContext.

Returns
ApplicationContext — The global ApplicationContext.
removeFile()method 
public function removeFile(file:ApplicationFile, recursiveRemoval:Boolean = false):void

Remove the specified ApplicationFile from the ApplicationContext. All the ApplicationFile having the specified file as dependency, will have it removed.

If the recursiveRemoval argument is set to true, then all the dependencies of the specified file will also be removed from the ApplicationContext. In the other case, all the dependencies of the specified ApplicationFile are cleared.

Parameters
file:ApplicationFile — The ApplicationFile to remove.
 
recursiveRemoval:Boolean (default = false) — If the removal must be applied on all the dependencies of the file.