Packageorg.spicefactory.lib.reflect.cache
Classpublic class DefaultReflectionCache
InheritanceDefaultReflectionCache Inheritance Object
Implements ReflectionCache

Default implementation of the ReflectionCache interface.



Public Properties
 PropertyDefined By
  active : Boolean
Indicates whether this cache instance is active.
DefaultReflectionCache
Public Methods
 MethodDefined By
  
addClass(type:ClassInfo, domain:ApplicationDomain = null):void
Adds the specified ClassInfo instance to this cache.
DefaultReflectionCache
  
getClass(type:Class, domain:ApplicationDomain = null):ClassInfo
Returns the matching ClassInfo instance for the specified class from this cache or null if no such instance has been cached yet.
DefaultReflectionCache
  
purgeAll():void
Clears the entire cache, removing all ClassInfo instances for all ApplicationDomains.
DefaultReflectionCache
  
purgeClass(type:Class, domain:ApplicationDomain = null):void
Removes a single class from the cache.
DefaultReflectionCache
  
purgeDomain(domain:ApplicationDomain):void
Clears the cache for the specified ApplicationDomain.
DefaultReflectionCache
Property Detail
activeproperty
active:Boolean

Indicates whether this cache instance is active. If the cache is not active, no further ClassInfo instances will be added to the cache when addClass is invoked. Setting this property to false does not clear the existing cached instance. Use one of the purge methods to clear the cache.

This property may be used to permanently or temporarily disable caching when reflection operations must be performed on classes which will not be reused afterwards.


Implementation
    public function get active():Boolean
    public function set active(value:Boolean):void
Method Detail
addClass()method
public function addClass(type:ClassInfo, domain:ApplicationDomain = null):void

Adds the specified ClassInfo instance to this cache. If the active flag is set to false, this method does nothing.

Parameters

type:ClassInfo — the ClassInfo instance to add to this cache
 
domain:ApplicationDomain (default = null) — the ApplicationDomain the ClassInfo belongs to

getClass()method 
public function getClass(type:Class, domain:ApplicationDomain = null):ClassInfo

Returns the matching ClassInfo instance for the specified class from this cache or null if no such instance has been cached yet.

Parameters

type:Class — the class to return the ClassInfo instance for
 
domain:ApplicationDomain (default = null) — the ApplicationDomain the class belongs to

Returns
ClassInfo — the matching ClassInfo instance for the specified class or null if no such instance has been cached yet
purgeAll()method 
public function purgeAll():void

Clears the entire cache, removing all ClassInfo instances for all ApplicationDomains.

purgeClass()method 
public function purgeClass(type:Class, domain:ApplicationDomain = null):void

Removes a single class from the cache. Use this method judiciously, as it might have the opposite effect that you might expect. If you remove a single ClassInfo instance that is referenced from other ClassInfo instance (as a property type for example) than it is still not egligible for garbage collection. Even worse, subsequent calls to ClassInfo.forClass (or forName etc.) will create a duplicate ClassInfo instance representing the same class and thus increasing the memory footprint.

Parameters

type:Class — the class to remove from the cache
 
domain:ApplicationDomain (default = null) — the ApplicationDomain the class belongs to

purgeDomain()method 
public function purgeDomain(domain:ApplicationDomain):void

Clears the cache for the specified ApplicationDomain.

Parameters

domain:ApplicationDomain — the domain to clear the reflection cache for