Runtime components : Core components : Typed data : Concepts : Property descriptors
  
Property descriptors
A property descriptor holds the type information for a typed data element. For example, a property descriptor for a data element of type Money would refer to the single instance of the type called Money. The typed data element identifies its property descriptor using its descriptor attribute. A non-typed data element has a null value in this attribute.
Property descriptors use parameters to describe their type. These parameters take the form of key-value pairs that can add attributes to the type, set attributes as mandatory, or specify an initial value for an attribute. For example, an Account instance must have an account number. The descriptor for the account number field uses the isMandatory="true" key-value pair to indicate this. The property descriptor and the data element store their parameters in a Hashtable. For the typed data elements, if the shareDataDescriptors flag in the btt.xml is set to true, the toolkit passes the data element's Hashtable of parameters in each call to the DataElement descriptor so that the default descriptor and its set of converters and validators can use the appropriate parameters instead of the default ones contained in the property descriptor's Hashtable to perform their tasks.
See
Default property descriptors
Simple and compound types
Property descriptor implementation
See also
Concepts
Default property descriptors
Each type has a default property descriptor. The purpose of this default property descriptor is not to describe the structure of the type. Instead, it specifies the default business rules and behavior for that data type, the validator used to check instance data, and converters used to transform instance data into a different format.
This graphic is described in the surrounding text.
For example, an IntegerDescriptor may specify minimum and maximum values, a validator to ensure that instance values are between the minimum and maximum, and a converter to transform and Integer instance into a String. Typically, the default behavior provided by the default property descriptor is sufficient for instances of the type to use unchanged. You can use the default property descriptor as a template for creating special property descriptors for more specific types. For example, the default property descriptor of a general type called Money (MoneyDescriptor) may describe most or all of the business rules for a data element called Balance of the specific type called Account. You would then use the MoneyDescriptor as the template to create the AccountDescriptor and add default business rules that are appropriate for accounts.
Note The default behavior provided by the default property descriptor may be sufficient for most purposes.
See also
Property descriptors
Simple and compound types
Types can be simple or compound. A simple type has a single property descriptor that completely describes the type. A compound type has multiple property descriptors: a default property descriptor and a property descriptor for each type in its structure. For example, a compound type called Address has a default property descriptor and other property descriptors. Examples of these other property descriptors include StreetName to describe the simple Street type and CityCode to describe the simple CityCode type. The <type> tag defines a type as being either simple by containing only the typeDefault property descriptor or compound by containing at least one extra property descriptor apart from the typeDefault.
The type definition for a compound type that represents a business object that is a keyed collection of different typed elements must have a descriptor with an implClass value of com.ibm.btt.base.types.KCollPropertyDescriptor (or a subclass). This allows the toolkit to access elements by key. The type definition must then follow this descriptor with a descriptor for each of the elements in that collection. The type definition for a compound type that represents a business object that is an indexed collection of elements of the same type must have a descriptor with an implClass value of com.ibm.btt.base.types.ICollPropertyDescriptor (or a subclass). This allows the toolkit to access elements by position. The type definition must then follow this descriptor with a descriptor for the type of the elements contained in the collection.
See also
Property descriptors
Property descriptor implementation
The hierarchy of property descriptor classes mirrors the hierarchy of non-typed data element classes. In the same way that DataElement is the parent for all data elements, AbstractPropertyDescriptor is the parent for all property descriptors and implements the PropertyDescription interface. Property descriptors for simple types inherit directly from this abstract super class in a similar way that data field classes inherit directly from DataElement. The toolkit provides property descriptors for basic types such as String, Integer, Float and Date (StringDescriptor, IntegerDescriptor, FloatDescriptor, and DateDescriptor). These classes are sample implementations of descriptors for simple types. Depending on application requirements, you may need to extend them or replace them with another implementation.
Compound property descriptors describe business objects that inherit from DataCollection (that is, from either KeyedCollection or IndexedCollection) to provide a way of capturing the more complex behavior and structure of the complex types. The toolkit provides the KCollPropertyDescriptor and ICollPropertyDescriptor, subclasses of AbstractPropertyDescriptor to describe compound business objects. The following diagram shows the relationships between the classes in the property descriptor hierarchy:
This graphic is described in the surrounding text.
See also
Property descriptors