Access keys

PropertyAlgorithm

Kind of class: class
Inherits from: BasicClass
Author: Simon Wacker
Classpath: org.as2lib.env.reflect.algorithm.PropertyAlgorithm
File last modified: Saturday, 02 July 2005, 22:43:52
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
org.as2lib.env.reflect.ClassInfo.getProperties method directly and do not have to make the detour
over this class. The org.as2lib.env.reflect.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.

Summary

Constructor
Instance methods
Instance methods inherited from BasicClass

Constructor

PropertyAlgorithm

function PropertyAlgorithm (
Void)
Constructs a new PropertyAlgorithm instance.

Instance methods

execute

function execute (
c:ClassInfo) : Array
Searches for all properties of the passed-in class c.

The resulting array contains org.as2lib.env.reflect.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:
c:
the class info instance representing the class to search through
Returns:
the found properties, an empty array or null