This section describes how to configure only the data classes shared by as3 and java. Generally, this data class only needs to be converted between as3 and java and has nothing to do with the database. For example, in data exchange between the client and the server, you need to define a data class ResultVO that uniformly returns the request. The result (bool) attribute indicates whether the request is successful, and the other attribute is data (object) indicates the returned data of the request. It is obvious that the data class has nothing to do with the database. If the configuration described in the previous article is used, redundant table creation data will be generated, in addition, some data types cannot be well supported.
Another configuration can be used for this data type. The configuration described in the previous article is similar, but the configuration of some databases is missing. The configuration format is as follows:
<Objects> <object name = "ResultVO" note = "request to return data" author = "idoublewei"> <field name = "success" type = "bool" value = "false" note = "request succeeded"/> <field name = "data" type = "object" value = "null" note = "request returned data"/> </object> </objects>
Only one root node objects can be configured. Each sub-Node object represents a data class, and each sub-node field of the object represents an attribute of the Data class.
Object:
--- Name indicates the data class name, which must be specified
--- Note data annotation, which can be left unspecified
--- Author data class Creator, which can be left unspecified
Field:
--- Name indicates the property name of the Data class, which must be specified
--- Type indicates the data class property type, which must be specified (case sensitive)
------ String indicates a string
------ Integer indicates an integer
------ Unsigned indicates a non-negative integer
------ Decimal indicates decimal
------ Bool indicates a Boolean Value
------ Date indicates the date
------ Array indicates an array
--- Value indicates the default value of the data class attribute, which can be left unspecified.
------ If the type is bool, the value can only be true or false.
------ If type is date, you can value: new-new object, MS-date millisecond count, followed by the symbol "|" + number, such as-MS | 428, format-date string, followed by the symbol "|" + date format characters, such as-format | 14-04-16 20:15:36 637
------ If the type is array, the value can be: new-new object, followed by the symbol "|" + element type (default value: object), such as-array | Integer
--- Note data class attribute annotation, which can be left unspecified
Note that if the specified data type is not in the supported data type list, the data type is output as is. For example, if the configuration property is
<field name="attr" type="com.vo.MyClass" value="null"/>
The output is
--- As3: var attr: com. vo. MyClass = null;
--- Java: com. vo. MyClass attr = null;
Therefore, it is best to write the type package name when the property type is set to custom type.