Specifics of TypeDescription object





The TypeDescription object describes which value types are allowed. It only makes sense in the appropriate context, and it is normally used for describing allowed values of an object that is capable of storing other values. For example, in a value table a TypeDescription object can describe allowed value types for each column.

Note that a TypeDescription object and a Type value are different entities. A Type value defines the type of a specific value, while a TypeDescription object defines the acceptable range of values for an entity that can store values.

In addition to the list of types, a TypeDescription object contains qualifiers for Date, String, and Number primitive types. The qualifiers allow setting additional restrictions to value ranges.

If a TypeDescription object contains multiple types, it implicitly includes Undefined type because Undefined is the default value for attributes of composite type. If a TypeDescription object contains a single type, the default value has that type.

Take this into account, for example, when using AllRefsType() methods. An AllRefsType() method does not return an array of reference types; it returns a TypeDescription object that describes available types. The AdjustValue() method of the TypeDescription object returned by the AllRefsType() method follows the logic for getting default values of composite types: if TypeDecription contains multiple types and the passed value does not match any of these types, AdjustValue() returns Undefined.

If a TypeDescription object does not contain any types, it is treated as if it can store any type and therefore executing the AllRefsType() method does not make sense.

Columns of query results might contain NULL values in addition to the source field types. Therefore, the type of a value table column retrieved by a query does not exactly match the source field type—it might have the NULL type added.


Comments
0
Add comment