4.5. Types

Every CapObject is an instance of a type. A type defines the properties that are appropriate for that object. Types are represented as CapType objects. Types are named and they may be put into a subtype hierarchy, which can be queried through the CapType objects.

For each property, a type aggregates a CapPropertyDescriptor object. There is one subclass of CapPropertyDescriptor for every kind of property value: IntegerPropertyDescriptor, LinkPropertyDescriptor, and so on.

Property descriptors provide further information about the property. In particular, the method isCollection() indicates whether the descriptor belongs to a collection-valued property.

The type and descriptor objects allow you to inspect the structure of the type system algorithmically. This is not required for many applications, but it allows you to write reusable algorithms that are supposed to act on CapObjects regardless of their actual internal structure.

Often, types act as factories. Using create methods, it is possible to build additional instances of a type. The methods for doing this are defined in the sub interfaces, though. They require additional information that depends on the repository that is used.

For more details on the type system, see the Javadoc of the mentioned classes.

Class Diagram: Types

Figure 4.3. Class Diagram: Types