Defining custom descriptors, converters, and validator for typed data

You can define custom descriptors, converters, and validator for typed data in the CHA Editor configuration file, the .chae file. After you defined the new descriptors, converters, and validator, you can use them with your typed data.

To edit the .chae file, start the CHA Editor and click the Configuration tab in the Editor view of the CHA Editor. You can then go on editing the contents of the .chae file.

You can also use any text editor to edit the .chae file.

Examples of defining new tags:

The following is a sample definition for FloatDescriptor:

<descriptor name="FloatDescriptor" javaClass="java.lang.Float">
	<compatibleImplClass name="com.ibm.btt.base.DataField" />
	<compatibleConverter name="FloatConverter" />
	<compatibleValidator name="FloatValidator" />
	<compatibleConverter name="DoubleConverter" />
	<compatibleValidator name="DoubleValidator" />
</descriptor>

The following is a sample definition for FloatConverter:

<converter name="FloatConverter" implClass="com.ibm.btt.base.types.ext.FloatConverter">
	<attribute name="convTypes" type="mandatory" defaultValue="default">
		<allowValue value="default"/>
		<allowValue value="serialization"/>
		<allowValue value="output"/>
		<allowValue value="xml"/>
		<allowValue value="host"/>
	</attribute>
		<attribute name="implClass" type="mandatory"/>
		<attribute name="binaryConversion" type="optional"/>
		<attribute name="size" type="optional">
			<allowValue value="4"/>
			<allowValue value="8"/>
		</attribute>
		<attribute name="byteOrdering" type="optional">
			<allowValue value="0"/>
			<allowValue value="1"/>
		</attribute>
</converter>

The following is a sample definition for FloatValidator:

<validator name="FloatValidator" implClass="com.ibm.btt.base.types.ext.FloatValidator">
	<attribute name="implClass" type="mandatory"/>
	<attribute name="lowerLimit"/>
	<attribute name="upperLimit"/>
</validator>
Note: CHA Editor now supports <Descriptor> tag. About <Descriptor> tag, please see Typed data elements. If the descriptor is not defined in *.chae, the CHA Editor will come up with an error message: The typeDefault Descriptor doesn't exist when you start the CHA Editor.