withAllSubclasses

withAllSubclasses(coll: ClassColl input);

The withAllSubclasses method of the Class class adds all subclasses of the receiver class up to and including the receiver class to the collection specified in the coll parameter. (Note that the collection is not cleared before instances are added.)

The following code fragment adds subclasses of the BankAccount class to a ClassColl collection.

vars
    classColl: ClassColl;
begin
    create classColl transient;
    BankAccount.withAllSubclasses(classColl);

When a class name is coded in a method (and colored green in the editor) the reference is evaluated to the root type of the class. In the following code fragment, only subclasses of the MemberKeyDictionary class from the RootSchema are added to the ClassColl collection; that is, local subclasses are not included.

vars
    classColl: ClassColl;
begin
    create classColl transient;
    MemberKeyDictionary.withAllSubclasses(classColl);

To find local subclasses of MemberKeyDictionary, use the getClass method of the Schema class to specify that the copy of MemberKeyDictionary in the current schema is to be used, as shown in the following code fragment.

vars
    classColl: ClassColl;
begin
    create classColl transient;
    currentSchema.getClass("MemberKeyDictionary").withAllSubclasses(classColl);