PackageMemberInfo
PackageInfo represents a real package in the Flash environment. This class
is used to get specific information about the package it represents.
You can use the static search methods forName and forPackage to get package infos for specific packages.
If you for example have a package you wanna get information about you first must
retrieve the appropriate PackageInfo instance and you can then use its
methods to get the wanted information.
var packageInfo:PackageInfo = PackageInfo.forPackage(org.as2lib.core);
trace("Package full name: " + packageInfo.getFullName());
trace("Parent package name: " + packageInfo.getParent().getName());
trace("Member classes: " + packageInfo.getMemberClasses());
trace("Member packages: " + packageInfo.getMemberPackages());
new PackageInfo()public function PackageInfo(package, name:String, parent:PackageInfo)
Constructs a new PackageInfo instance.
Note that you do not have to pass-in the concrete package. But if you
do not pass it in some methods cannot do their job correctly.
If you do not pass-in the name or the parent they are resolved
lazily when requested using the passed-in package.
package | the actual package this instance represents |
name | (optional) the name of the package |
parent | (optional) the parent package |
static public function forName(packageName:String):PackageInfo
Returns the package info corresponding to the passed-in packageName.
The passed-in packageName must be composed of the preceding path and
the actual package name, that means it must be fully qualified. For example
"org.as2lib.core".
This method first checks whether the package is already contained in the cache.
packageName | the fully qualified name of the package to find |
the package info corresponding to the passed-in packageName
| IllegalArgumentException | if the passed-in packageName is null,
undefined or an empty string or if the object corresponding to the passed-in
packageName is not of type "object"
|
| PackageNotFoundException | if a package with the passed-in packageName
could not be found
|
static public function forPackage(package):PackageInfo
Returns the package info corresponding to the passed-in package.
This method first checks whether the package info is already contained in the cache.
package | the package you wanna get the package info for |
the package info corresponding to the passed-in package
| IllegalArgumentException | if the passed-in package is null
or undefined
|
static public function setPackageAlgorithm(newPackageAlgorithm:PackageAlgorithm):VoidSets the algorithm used to find packages.
If newPackageAlgorithm is null or undefined,
getPackageAlgorithm will return the default package algorithm.
newPackageAlgorithm | the new algorithm to find packages |
static public function getPackageAlgorithm(Void):PackageAlgorithmReturns the algorithm used to find packages.
Either the algorithm set via setPackageAlgorithm method will be returned or the default one which is an instance of class PackageAlgorithm.
the set or the default package algorithm
static public function setPackageMemberAlgorithm(newPackageMemberAlgorithm:PackageMemberAlgorithm):VoidSets the algorithm used to find members of packages.
Members of packages are classes, interfaces and packages.
If newPackageMemberAlgorithm is null or undefined,
getPackageMemberAlgorithm will return the default package member
algorithm.
newPackageMemberAlgorithm | the new algorithm to find members of packages |
static public function getPackageMemberAlgorithm(Void):PackageMemberAlgorithmReturns the member algorithm used to find members of packages.
Either the algorithm set via setPackageMemberAlgorithm will be returned or the default one which is an instance of class PackageMemberAlgorithm.
the set or the default member algorithm
static public function getRootPackage(Void):PackageInfoReturns the root package of the package hierarchy.
If you do not set a custom root package via the
method, the default root package is returned that refers to _global.
the root package of the package hierarchy.
static public function setRootPackage(newRootPackage:PackageInfo):VoidSets the new root package of the package hierarchy.
If the passed-in newRootPackage argument is null or
undefined the method will return the default
root package.
newRootPackage | the new root package of the package hierarchy |
public function getName(Void):StringReturns the name of the represented package.
This does not include the package's path/namespace. If this package info
represented for example the org.as2lib.core package the returned
name would be "core".
the name of the represented package
public function getFullName(Void):StringReturns the fully qualified name of the represented package. This means the name of the package plus its package path/namespace.
The path is not included if:
null or undefined. true.
the fully qualified name of the package
public function getPackage(Void)Returns the actual package this instance represents.
the actual package
public function getParent(Void):PackageInfoReturns the parent of the represented package.
The parent is the package the represented package is contained in / a member
of. The parent of the package org.as2lib.core is org.as2lib.
the parent of the represented package
public function getMembersByFlag(filterSubPackages:Boolean):ArrayReturns an array containing PackageMemberInfo instances representing the members of the package and maybe the ones of the sub-packages.
The members of the package are all types and packages contained in the represented package.
If filterSubPackages is null or undefined it is
interpreted as true, that means sub-packages' package members will be
filtered/excluded from the result by default.
null will be returned if
null or undefined. execute method of the algorithm returned by
getPackageMemberAlgorithm returns null or undefined.
filterSubPackages | (optional) determines whether to filter the sub-packages' members |
an array containing the members of the represented package
public function getMembersByFilter(packageMemberFilter:PackageMemberFilter):ArrayReturns an array containing PackageMemberInfo instances representing the members of the package and sub-packages that are not filtered/excluded.
The members of this package are all types and packages contained in the represented package.
The PackageMemberFilter.filter method of the passed-in packageMemberFilter
is invoked for every package member to determine whether it shall be contained
in the result.
If the passed-in packageMemberFilter is null or undefined
the result of the invocation of getMembersByFlag with argument true
will be returned.
null will be returned if:
null or undefined. execute method of the algorithm returned by
getPackageMemberAlgorithm returns null or undefined.
packageMemberFilter | the filter that filters unwanted package members out |
an array containing the remaining members of the represented package
public function getMemberClassesByFlag(filterSubPackages:Boolean):ArrayReturns an array containing ClassInfo instances representing the member classes of the package and maybe the ones of the sub-packages.
If filterSubPackages is null or undefined it is
interpreted as true, this means that sub-packages' classes are filtered
by default.
null will be returned if:
null or undefined. execute method of the algorithm returned by
getPackageMemberAlgorithm returns null or undefined.
filterSubPackages | (optional) determines whether to filter/exclude the sub-packages' member classes |
an array containing the member classes of the represented package
public function getMemberClassesByFilter(classFilter:PackageMemberFilter):ArrayReturns an array containing ClassInfo instances representing the class members of the package and sub-packages that are not filtered/excluded.
The PackageMemberFilter.filter method of the passed-in classFilter
is invoked for every member class to determine whether it shall be contained in
the result.
If the passed-in clasFilter is null or undefined the
result of an invocation of getMemberClassesByFlag with argument true
will be returned.
null will be returned if:
null or undefined. execute method of the algorithm returned by
getPackageMemberAlgorithm returns null or undefined.
classFilter | the filter that filters unwanted member classes out |
an array containing the remaining member classes of the represented package
public function getMemberPackagesByFlag(filterSubPackages:Boolean):ArrayReturns an array containing PackageInfo instances representing the member packages of the package and maybe the ones of the sub-packages.
If filterSubPackages is null or undefined it is
interpreted as true, this means sub-packages' packages are filtered
by default.
null will be returned if:
null or undefined. execute method of the algorithm returned by
getPackageMemberAlgorithm returns null or undefined.
filterSubPackages | (optional) determines whether the sub-packages' member packages shall be filtered/excluded from or included in the result |
an array containing the member packages of the represented package
public function getMemberPackagesByFilter(packageFilter:PackageMemberFilter):ArrayReturns an array containing PackageInfo instances representing the package members of the package and sub-packages that are not filtered/excluded.
The PackageMemberFilter.filter method of the passed-in packageFilter
is invoked for every member package to determine whether it shall be contained
in the result.
If the passed-in packageFilter is null or undefined
the result of the invocation of getMemberPackagesByFlag with argument
true will be returned.
null will be returned if:
null or undefined. execute method of the algorithm returned by
getPackageMemberAlgorithm returns null or undefined.
packageFilter | the filter that filters unwanted member packages out |
an array containing the remaining member packages of the represented package
public function getMemberByName(memberName:String):PackageMemberInfo
Returns the package member info corresponding to the passed-in memberName.
If the package member with the passed-in memberName cannot be found
directly in the represented package its sub-packages are searched through.
null will be returned if:
null or undefined. memberName is null or undefined. memberName.memberName | the name of the member to return |
the member corresponding to the passed-in memberName
public function getMemberByMember(concreteMember):PackageMemberInfo
Returns the package member info corresponding to the passed-in
concreteMember.
If the package member corresponding to the passed-in concreteMember
cannot be found directly in the represented package its sub-packages are
searched through.
null will be returned if:
null or undefined. concreteMember is null or undefined.concreteMember | the concrete member to find |
the package member info instance corresponding to the concreteMember
public function getMemberClassByName(className:String):ClassInfo
Returns the class info corresponding to the passed-in className.
If the member class with the passed-in className cannot be found
directly in the represented package its sub-packages are searched through.
null will be returned if:
className is null or undefined. className.className | the name of the class |
the class info corresponding to the passed-in className
public function getMemberClassByClass(concreteClass:Function):ClassInfo
Returns the class info corresponding to the passed-in concreteClass.
If the member class corresponding to the passed-in concreteClass
cannot be found directly in the represented package its sub-packages are
searched through.
null will be returned if:
concreteClass is null or undefined. concreteClass in this
package or any sub-packages.concreteClass | the concrete class a corresponding class info shall be returned |
the class info corresponding to the passed-in concreteClass
public function getMemberPackageByName(packageName:String):PackageInfo
Returns the package info corresponding to the passed-in packageName.
If the member package with the passed-in packageName cannot be found
directly in the represented package its sub-packages are searched through.
null will be returned if:
packageName is null or undefined. null. packageName.packageName | the name of the package |
the package info corresponding to the passed-in packageName
public function getMemberPackageByPackage(concretePackage):PackageInfo
Returns the package info corresponding to the passed-in concretePackage.
If the member package corresponding to the passed-in concretePackage
cannot be found directly in the represented package its sub-packages are
searched through.
null will be returned if:
concretePackage is null or undefined. null. concretePackage could not be found.concretePackage | the concrete package the corresponding package info shall be returned for |
the package info corresponding to the passed-in concretePackage
public function isRoot(Void):BooleanReturns whether this package is a root package.
It is supposed to be a root package when its parent is null.
true if this package info represents a root package else false
public function isParentPackage(package:PackageInfo):Boolean
Returns true if this package is the parent package of the passed-in
package.
false will be returned if:
package is not a parent package of this package. package is null or undefined. package equals this package. package's isRoot method returns true.package | package this package may be a parent of |
true if this package is the parent of the passed-in package
public function toString():StringReturns the string representation of this instance.
The string representation is constructed as follows:
[reflection fullyQualifiedNameOfReflectedPackage]
this instance's string representation
toString() in org.as2lib.core.BasicInterface