Field Type Conversion

When a tuple is stored into a space, the fields that it contains must match the names and types of the fields described in the space definition. If there is a type mismatch between a field contained in the tuple and the type of the field defined in the space field definition, then, if possible, ActiveSpaces performs an automated field conversion. If the conversion is not possible, the operation fails.

The following table shows which type conversions are supported. The letters in the table have the following meanings:

  • x: Conversion is supported with no loss of precision.
  • l:  Conversion is supported, but with loss of precision.
  • N  Conversion is not supported.
    Field Type Conversions
      Boolean Short Integer Long Float Double Blob String DateTime
    Boolean x x x x x x N N N
    Short l x x x x x N N N
    Integer l l x x l x N N N
    Long l l l x l l N N N
    Float l l l l x x N N N
    Double l l l l l x N N N
    Blob N N N N N N x N N
    String N N N N N N x x N
    DateTime N N N N N N N N x

There is a Get and Put method for each type of field. In Java, an overloaded Put method is also provided for convenience.

For general information on operations applied to tuples, see The getName and getSpaceDef Methods.