org.as2lib.core.BasicClass +--org.as2lib.env.reflect.algorithm.PropertyAlgorithm
PropertyAlgorithm
searches for all properties of a class.
Properties are not variables but implicit getters and setters that can be
added via the set
or get
keyword or the addProperty
method.
This class is mostly used internally. If you wanna obtain the properties of a
class you need its representing ClassInfo
. You can then also use the
ClassInfo.getProperties method directly and do not have to make the detour
over this class. The ClassInfo.getProperties method is also easier to use
and offers some extra functionalities.
If you nevertheless want to use this class here is how it works.
var classInfo:ClassInfo = ClassInfo.forClass(MyClass);
var propertyAlgorithm:PropertyAlgorithm = new PropertyAlgorithm();
var properties:Array = propertyAlgorithm.execute(classInfo);
Refer to the execute method for details on how to get data from the properties array appropriately.
public function execute(c:ClassInfo):Array
Searches for all properties of the passed-in class c
.
The resulting array contains PropertyInfo instances.
null
will be returned if:
c
is null
or undefined
. getType
method of the passed-in class returns null
.Only the passed in class will be searched through, no super classes.
The found properties are stored in the resulting array by index as well as by
name. This means you can obtain PropertyInfo
instances either by index:
var myProperty:PropertyInfo = myProperties[0];
Or by name:
var myProperty:PropertyInfo = myProperties["myPropertyName"];
c | the class info instance representing the class to search through |
the found properties, an empty array or null