org.as2lib.core.BasicClass +--org.as2lib.env.reflect.algorithm.PackageAlgorithm
PackageAlgorithm
searches for the specified package and returns the
package info representing the found package.
To obtain the package info corresponding to package you use this class as
follows.
var packageAlgorithm:PackageAlgorithm = new PackageAlgorithm();
var packageInfoByPackage:PackageInfo = packageAlgorithm.execute(org.as2lib.core);
It is also possible to retrieve a package info by name.
packageInfoByName:PackageInfo = packageAlgorithm.executeByName("org.as2lib.core");
Already retrieved package infos are stored in a cache. There thus exists only
one PackageInfo
instance per package. The following traces true
.
trace(packageInfoByPackage == packageInfoByName);
public function setCache(cache:Cache):Void
Sets the cache that is used by the execute method to look whether the package to find is already stored and where to start the search if not.
cache | the new cache |
public function getCache(Void):Cache
Returns the cache set via the setCache method or the default cache that is returned by the ReflectConfig.getCache method.
the currently used cache
public function execute(o)
Executes the search for the passed-in package o
and returns information
about this package.
The returned object has the following properties:
Object
that has been searched for, this is the
passed-in package o
. String
of the searched for package. null
will be returned if:
o
is null
or undefined
. o
could not be found.The search starts on the package returned by the cache's getRoot
method, this is by default _global
.
o | the package to return information about |
an object that contains information about the passed-in package
public function executeByName(n:String):PackageInfo
Returns the package info representing the package corresponding to the passed-in
package name n
.
The name must be fully qualified, that means it must consist of the package's path as well as its name. For example 'org.as2lib.core'.
The search starts on the package returned by the Cache.getRoot method
of the set cache. If this method returns a package info whose getFullName
method returns null
, undefined
or an empty string "_global"
is used instead
n | the fully qualified name of the package |
the package info representing the package corresponding to the passed-in name
IllegalArgumentException | if the passed-in name is null ,
undefined or an empty string or if the object corresponding to the
passed-in name is not of type "object"
|
PackageNotFoundException | if a package with the passed-in name could not be found |