ValueMetaInterface objects are used to determine the characteristics of the row fields. They are typically obtained from a
RowMetaInterface object, which is acquired by a call to
getType() method returns one of the static constants declared by
ValueMetaInterface to indicate the PDI field type. Each field type maps to a corresponding native Java type for the actual value. The following table illustrates the mapping of the most frequently used field types.
|PDI data type||Type constant||Java data type||Description|
|String||TYPE_STRING|| ||A variable unlimited length text encoded in UTF-8 (Unicode)|
|Integer||TYPE_INTEGER|| ||A signed long 64-bit integer|
|Number||TYPE_NUMBER|| ||A double precision floating point value|
|BigNumber||TYPE_BIGNUMBER|| ||An arbitrary unlimited precision number|
|Date||TYPE_DATE|| ||A date-time value with millisecond precision|
|Boolean||TYPE_BOOLEAN|| ||A boolean value |
|Binary||TYPE_BINARY|| ||An array of bytes that contain any type of binary data.|
Do not assume that the Java value of a row field matches these data types directly. This may or may not be true, based on the storage type used for the field.
In addition to the data type of a field, the storage type,
setStorageType(), is used to interpret the actual field value in a row array. These storage types are available.
|Type constant||Actual field data type||Interpretation|
|STORAGE_TYPE_NORMAL||As listed in previous table||The value in the row array is of the type listed in the data type table above and represents the field value directly.|
|STORAGE_TYPE_BINARY_STRING|| ||The field has been created using the Lazy Conversion feature. This means it is a non-altered sequence of bytes as read from an external medium, usually a file.|
|STORAGE_TYPE_INDEXED|| ||The row value is an integer index into a fixed array of possible values. The |
Accessing Row Values
In a typical data processing scenario, a step is not interested in dealing with the complexities of the storage type. It just needs the actual data value on which to do processing. In order to safely read the value of a field, the
ValueMetaInterface object provides a set of accessor methods to get at the actual Java value. The argument is a value from a row array that corresponds to the
ValueMetaInterface object. The accessor methods always return a proper data value, regardless of the field storage type.
For each of these methods,
RowMetaInterface has corresponding methods that require the row array and the index of the field as arguments.
Additional Field Characteristics
ValueMetaInterface represents all aspects of a PDI field, including conversion masks, trim type, and alike. All of these are available using corresponding accessor methods, such as
getTrimType(). Refer to the Javadoc for a complete overview.