Sun WBEM SDK Developer's Guide

Examples — associators and associatorNames Methods

The examples in this section show how to use the associators and associatorNames methods to get information about the classes associated with the Teacher and Student classes shown in the following figure. Notice that the associatorNames method does not take the arguments includeQualifiers, includeClassOrigin, and propertyList because these arguments are irrelevant to a method that returns only the names of instances or classes, not their entire contents.

Figure 4–2 Teacher-Student Association Example

Graphic

Table 4–9 associators and associatorNames Methods

Example 

Output 

Description 

associators(Teacher, null, null, null, null, false, false, null)

Student class

Returns associated classes and their subclasses.Student is linked to Teacher by the TeacherStudent association.

associators(Student, null, null, null, null,false, false, null)

Teacher, MathTeacher, and ArtTeacher classes

Returns associated classes and their subclasses. Teacher is linked to Student by the TeacherStudent association. MathTeacher and ArtTeacher inherit the TeacherStudent association from Teacher.

associatorNames(Teacher, null, null, null, null)

Name of the Student class

Returns the names of the associated classes and their subclassesStudent is linked to Teacher by the TeacherStudent association.

associatorNames(Student, null, null, null, null)

Teacher, MatchTeacher, and ArtTeacher class names.

Returns the names of the associated classes and their subclasses. Teacher is linked to Student by the TeacherStudent association. MatchTeacher and ArtTeacher inherit the TeacherStudent association from Teacher.