Package | org.spicefactory.lib.reflect.cache |
Class | public class DefaultReflectionCache |
Inheritance | DefaultReflectionCache Object |
Implements | ReflectionCache |
Property | Defined By | ||
---|---|---|---|
active : Boolean
Indicates whether this cache instance is active. | DefaultReflectionCache |
Method | Defined By | ||
---|---|---|---|
Adds the specified ClassInfo instance to this cache. | DefaultReflectionCache | ||
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 |
active | property |
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.
public function get active():Boolean
public function set active(value:Boolean):void
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
|
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
|