5.3 Type Mapping

Correctly processing the type is the key that the database, the server, the client work properly.


  • Primitive Type

    XML description Java C# C++ Javascript Lua
    boolean boolean bool bool Boolean Boolean
    byte byte byte int8_t Number Number
    short short short int16_t Number Number
    int int int int32_t Number Number
    long long long int64_t Number Number
    float float float float Number Number
    double double double double Number Number
    string string string std::string String String
    binary Octets Octets Octets Array(Number) Table(Number)
    any:[type] type Not support Not support Not support Not support

    Except that the byte of the C# is the unsigned type, all the other numeric types are signed type, which might cause the difference in the processing. Be careful.

    The long type should be carefully used in the script client. The Number of the script client is internally represented as the double. The accuracy of the long is less than 64 bits. According to the starndard of the IEEE754, the javascript could provide 52 effective bits, however the Lua5.1 provides less bits without the reasonable reason. Based on this practical consideration, a special processing is made during the script data encoding, that the long type that absolute value is less than or equals to 0x3FFFFFFFFFFFL is encoded according to the numerical value, the other is encoded as the string, to guarantee the consistency of the expression after decoding.

    The string of the server encodes with UTF8 schema and the client need to convert by itself if necessary. Without the encode and decode library, the binary could be used as the replacement and interpreted by itself.

    The any type could not directly or indirectly referred by any bean, protocol, rpc, and view.


  • Container Type

    XML description Java C# C++ Javascript Lua
    List LinkedList LinkedList std::list Array Table
    Vector ArrayList List std::vector Array Table
    Set HashSet HashSet std::unordered_set Array Table
    Map HashMap Dictionary std::unordered_map Map Table

    All the containers in the typed languages use the generic type.

    The specification itself of the Javascript does not contain the Map, and the Javascript environment in the all browsers has its own implemented version. The implementation of the Javascript engine coming from the OracleJDK itself has no Map, and the simple implementation -- map.js built in the Limax is used.


  • Constructor Type

    XML description Java C# C++ Javascript Lua
    Bean Class Class class Map Table
    Cbean Class Class class Map Table
    Xbean Class Class class Map Table

    All the bean in the typed languages are defined as the class. The protocol, rpc, view, control, and the bind which refers to partial fields of the bean generate the class code.

    The simple description of the allowed reference relationship (directly or indirectly refer via container):


    bean := bean* | cbean* | xbean*                      
    

    The bean is not allowed to be finally referred to the Any type.


    cbean := cbean*
    xbean := cbean* | xbean*                      
    

    In the script languages, there is no the concept of the class. During the execution, the object data is directly generated to the associated container with the field name as the key.


Prev Next