| Package | com.developmentarc.framework.utils |
| Class | public class InstanceFactory |
| Subclasses | SingletonFactory |
This class is useful when only a single instance of an item is required but not on a Framework/Application level. If you need a Framework/Application level Singleton instance, use the SingletonFactory to generate your instance.
| Property | Defined by | ||
|---|---|---|---|
| instanceTable : HashTable
Stores the local instances for the factory.
| InstanceFactory | ||
| Method | Defined by | ||
|---|---|---|---|
|
Constructor.
| InstanceFactory | ||
|
clearAllInstances():void
Used to remove all current instances from the Factory.
| InstanceFactory | ||
|
clearInstance(type:Class):void
Used to remove a specific instance type from the factory.
| InstanceFactory | ||
|
getInstance(type:Class):*
Used to get access to an instance of the Class type
requested.
| InstanceFactory | ||
| instanceTable | property |
protected var instanceTable:HashTableStores the local instances for the factory.
| InstanceFactory | () | constructor |
public function InstanceFactory()Constructor.
| clearAllInstances | () | method |
public function clearAllInstances():voidUsed to remove all current instances from the Factory.
| clearInstance | () | method |
public function clearInstance(type:Class):voidUsed to remove a specific instance type from the factory. This method checks to see if the requeted type has an intance in the table, and if so the instance is removed. This enables getInstance() to create a new instance the next time the method is called. If the instance type does not exist, nothing occurs.
Parameterstype:Class — The type of instance to look for and remove.
|
| getInstance | () | method |
public function getInstance(type:Class):*Used to get access to an instance of the Class type requested. This method first determines if the Class type has been requested before. If the Class has never been requested, the method creates a new instance of the Class, stores it in a table and then returns a reference to the Class.
If the Class type has been requested previously, the method returns the previously generated instance.
Parameterstype:Class — The Class of the instance to return.
|
* — The generated instance of the Class.
|