Class org.as2lib.env.reflect.algorithm.PropertyAlgorithm

org.as2lib.core.BasicClass
   +--org.as2lib.env.reflect.algorithm.PropertyAlgorithm

Description

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.

Method Index

new PropertyAlgorithm()

execute()

Inherited from BasicClass

toString()

Constructor Detail

PropertyAlgorithm

public function PropertyAlgorithm(Void)

Constructs a new PropertyAlgorithm instance.

Method Detail

execute

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:

  • The passed-in class c is null or undefined.
  • The 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"];

Parameters

cthe class info instance representing the class to search through

Return

the found properties, an empty array or null