Cache
| Kind of class: | interface |
|---|---|
| Inherits from: | BasicInterface |
| Implemented by: | |
| Author: | Simon Wacker |
| Classpath: | org.as2lib.env.reflect.Cache |
| File last modified: | Monday, 23 May 2005, 11:24:46 |
Cache chaches classes and packages.
The caching of classes and packages leads to better performance. You also
must cache them because for example the parent of two classes residing in the
same package should be the same PackageInfo instance.
The cache is mostly used internally. But you can also use it to add
ClassInfo or PackageInfo instances directly so that they do not
have to be searched for. This can improve the performance dramatically with
classes or packages that are needed quite often.
Summary
Instance methods
Instance methods inherited from BasicInterface
Instance methods
addClass
Adds the passed-in
this
classInfo to the list of cached class infos and returnsthis
classInfo.Parameters:
classInfo:
the class info to add
Returns:
the passed-in and added
classInfoaddPackage
function addPackage (
packageInfo:PackageInfo) : PackageInfo
Adds the passed-in
packageInfo to this cache and returns this addedpackageInfo.Parameters:
packageInfo:
the package info to add
Returns:
the passed-in and added
packageInfogetClass
function getClass (
) : ClassInfo
getClassByClass
function getClassByClass (
clazz:Function) : ClassInfo
Returns the class info representing the passed-in
clazz.null will be returned if:
- There is no corresponding
ClassInfoinstance cached. - The passed-in
clazzisnullorundefined.
Parameters:
clazz:
the class to return the class info for
Returns:
the class info representing the passed-in
clazzgetClassByInstance
function getClassByInstance (
instance) : ClassInfo
Returns the class info representing the class the
instantiated of.
instance wasinstantiated of.
null will be returned if:
- There is no corresponding
ClassInfoinstance cached. - The passed-in
instanceisnullorundefined.
Parameters:
instance:
the instance to return the appropriate class info for
Returns:
the class info representing the instance's class
getPackage
function getPackage (
package) : PackageInfo
Returns the package info representing the passed-in
package.null will be returned if:
- There is no corresponding
PackageInfoinstance cached. - The passed-in
packageisnullorundefined.
Parameters:
package:
the package to return the appropriate package info for
Returns:
the pakcage info representing the passed-in
packagegetRoot
function getRoot (
Void) : PackageInfo
Returns the root package of the whole package hierarchy.
The root package is also refered to as the default package.
The root/default package determines where the ClassAlgorithm and
PackageAlgorithm classes start their search.
Returns:
the root/default package
releaseAll
function releaseAll (
Void) : Void
Releases all cached class and package infos.