org.as2lib.core.BasicClass +--org.as2lib.env.reflect.algorithm.PackageMemberAlgorithm
PackageMemberAlgorithm
searches for members, that means types and packages,
of a specific package. Sub-packages are not searched through.
This class is mostly used internally. If you wanna obtain the members of a
package you need its representing PackageInfo
. You can then also use the
PackageInfo.getMembers, PackageInfo.getMemberClasses and
PackageInfo.getMemberPackages methods directly and do not have to make
the detour over this method. The PackageInfo's methods are also easier to use and
offer some extra functionalities.
If you nevertheless want to use this class here is how it works.
var packageInfo:PackageInfo = PackageInfo.forPackage(org.as2lib.core);
var packageMemberAlgorithm:PackageMemberAlgorithm = new PackageMemberAlgorithm();
var members:Array = packageMemberAlgorithm.execute(packageInfo);
Refer to the execute method for details on how to get data from the members array appropriately.
public function setCache(cache:Cache):Void
Sets the cache that is used by the execute method to look whether the member package or class is already stored and to get the root package 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(p:PackageInfo):Array
Executes the search for the members, that means member types and packages, in
the passed-in package p
.
The resulting array contains instances of type PackageMemberInfo, that is either of type ClassInfo or PackageInfo.
The specific members can be either referenced by index or by name.
myMembers[0];
myMembers.classes[0];
myMembers.packages[0];
myMembers.MyClass;
or myMembers.mypackage
myMembers.classes.MyClass;
myMembers.packages.mypackage;
null
will be returned if:
p
is null
or undefined
. getPackage
method of the passed-in package returns null
.Only the passed-in package p
will be searched through, no sub-packages.
In case the cache already contains a specific member class or package the contained info it will be added to the resulting members array.
the members of the package, an empty array or null