The package named com.ibm.btt.base.types.ext provides a sample implementation
of simple types. This package contains property descriptors, converters, and
validators for the String, Date, Integer, Float, and Double simple types.
Some of these converters and validators have some attributes that you can
initialize externally as key-value pairs in the types definition file. You
can extend all of these classes and override their methods if necessary.
Sample property descriptors
- DatePropertyDescriptor
- DoublePropertyDescriptor
- FloatPropertyDescriptor
- IntegerPropertyDescriptor
- StringPropertyDescriptor
Sample converters
- DateConverter - The toolkit implements this converter using the
java.text.SimpleDateFormat. Date Converter has the mask attribute, which sets
the pattern of the SimpleDateFormat. The default value of the property is
"dd.mm.yyyy".
- FloatConverter - This converter performs a conversion based on
the value of its binaryConversion property. The following is a list of the
FloatConverter properties:
- binaryConversion - If this property is true, the converter uses
a byte representation of the number to perform the host-oriented conversion.
The converter also uses the size and byteOrdering attributes to do the conversion.
If this property is false, the converter uses the standard Float conversion
and ignores the size and byteOrdering attributes. The default value is false.
- size - The value of this property determines the type of objects
that the converter handles. If it has a value of 4, the converter works with
Floats. If it has a value of 8, the converter works with Doubles. The default
value is 8.
- byteOrdering - This property can have a value of 0 for big-endian
byte ordering (host environment) or 1 for little-endian byte ordering (PC
environment). can take one of two values:
- IntegerConverter - This converter performs a conversion based
on the value of its binaryConversion property. The following is a list of
the ImageConverter properties:
- binaryConversion - If this property is true, the converter uses
a byte representation of the number to perform the host-oriented conversion.
The converter also uses the size, byteOrdering, and sign properties to do
the conversion. If this property is false, the converter uses the standard
Float conversion and ignores the other properties. The default value is false.
- size - The value of this property determines the type of objects
that the converter handles. The values it can have range from 1 to 8.
- 1 = Bytes
- 2 = Short
- 3 or 4 = Integers
- 5, 6, 7, 8 = Longs
The default value is 3.
- byteOrdering - This property can have a value of 0 for big-endian
byte ordering (host environment) or 1 for little-endian byte ordering (PC
environment).
- sign - If this property is true, the converter with a sign. The default
value is false.
- NumericStringConverter - This converter transforms
Numeric business objects into Strings by using the java.text.DecimalFormat
class. It has the following properties, which the converter uses to setup
the DecimalFormat instance.
- usePositiveSign - The default value is 1.
- signRule - The default value is 1.
- useThousandsSeparator - A boolean property with a default value of true.
- decimalPlaces - The default value is 10.
- decimalSeparator - The default value is a period (.).
- thousandsSeparator - The default value is a comma (,).
- StringConverter - The converter for String business objects. This
converter takes no parameters.
- TimeConverter - The converter for Date business objects using
the java.text.SimpleDateFormat. This converter includes the time in the Date
representation. The following is a list of the TimeConverter properties:
- mask - The converter uses this property to set the pattern of the SimpleDateFormat.
The default value is "hh:mm:ss".
- amString - The converter uses this property to hold the String used in
the DateFormatSymbols to indicate a time before noon when setting up the SimpleDateFormat.
The default value is "am".
- pmString - The converter uses this property to hold the String used in
the DateFormatSymbols to indicate a time after noon when setting up the SimpleDateFormat.
The default value is "pm".
- hours24 - If this property is true, the converter transforms based on
the 24 hour clock. If this property is false, the converter uses the amString
and pmString properties. The default value is true.