The toolkit has a hierarchy of data elements. At the top of the hierarchy is the DataElement class. This abstract class is the base class for single data items or data collections. It provides a mandatory ID instance variable for identification and an optional description instance variable for description. A data element can either have a value or it can be a collection of other data elements. This maximizes reusability of code and follows the Composite design pattern in which any element of the collection can itself be a collection. DataCollection is the abstract base class for collections and provides methods for adding, retrieving, and deleting data elements. DataCollection is a subclass of DataElement.
The data elements hierarchy is extensible, and new classes can be derived easily when more functionality is needed. The following sections describe the data elements provided by the toolkit.
A data field represents a single data item and is the only data element provided by the toolkit that has a value. Each one has a value instance variable for storing the value of the data item. Because the toolkit accesses data held in a data field using the field's name, the name for the data field name should be unique. The data field attributes "value" and "description" can be overridden by another reference data.
The com.ibm.btt.base.DataField class is the implementation provided by the toolkit. The toolkit uses the <field> tag to externalize data fields.
A keyed collection contains an ordered collection of data elements identified by name. Because it holds key-value pairs, a keyed collection is similar to a dictionary.
Within a keyed collection, the name of each data element must be unique but the name does not have to be unique in the entire structure of data elements. For example, a keyed collection named kColl1 contains two data fields, field1 and field2 and another keyed collection, kColl2. The data fields and keyed collection cannot have the same name. However, kColl2 can have fields named field1 and field2 even though kColl1 also has fields with those names. The keyed collection data attributes "dynamic" and "description" can be overridden by another reference data.
The com.ibm.btt.base.KeyedCollection class is the implementation provided by the toolkit. The toolkit uses the <kColl> tag to externalize keyed collections.
An indexed collection contains an ordered collection (that is, an array-type collection) of instances identified by their position in the collection. All of the data elements in the indexed collection must be the same type. For example, the data elements in an indexed collection of addresses are all instances of a keyed collection whose associated type is Address. The indexed collection data attributes "size" and "description" can be overridden by another reference data.
The com.ibm.btt.base.IndexedCollection class is the implementation provided by the toolkit. The toolkit uses the <iColl> tag to externalize indexed collections.