Extending : Data type extension : Implementing data type extension : Declaring a new data type
  
Declaring a new data type
To create a project-specific data type, a technical developer must first declare the new type in the type.xml file.
The declaration consists of the following components:
Type id
Implementation class
Property descriptor
Shown below is a sample definition of a type:
<type id="Currency" implClass="com.ibm.btt.base.DataField">
  <Descriptor id="typeDefault" implClass="com.ibm.btt.base.types.impl.SimplePropertyDescriptor">
    <Converter convTypes="default" implClass="com.ibm.btt.base.types.impl.CurrencyConverter">
    </Converter>
    <Validator implClass="com.ibm.btt.base.types.impl.CurrencyValidator"/>
  </Descriptor>
</type>
Type id
The id is the name of the type. The type id must be unique.
Implementation class
impClass defines the implementation class of the type. For a simple type that has only one property, the implementation class is com.ibm.btt.base.DataField. For a compound type that has multiple properties, the implementation class is com.ibm.dse.base.KeyedCollection or com.ibm.btt.base.IndexedCollection.
Property descriptor
The property descriptor specifies the default business rules and behavior for a data type. A property descriptor can have one validator, which is used to check instance data, and one or multiple converters, which are used to transform instance data into a different format. A simple type has only one property descriptor. A compound type has multiple property descriptors.
In most cases, a technical developer does not need to implement their own property descriptor class. UDTT provides the SimplePropertyDescriptor property descriptor class for simple types, KCollPropertyDescriptor and ICollPropertyDescriptor for compound types, and StringDescriptor, IntegerDescriptor, FloatDescriptor, and DateDescriptor for basic types. A technical developer can also implement their own property descriptor by extending AbstractPropertyDescriptor, which is the parent property descriptor class for all property descriptors.
Hierarchy of the property descriptor classes
This graphic is described in the surrounding text.
See also
Implementing data type extension