...
- Array types are limited to primitive, built-in, and embedded entity types. They are intended to allow embedded values that are transported along with a message or entity, and consequently:
- Queue, Set and Queue and Map types can only be used with non-embedded entities and may only use other non-embedded entities as their values.
...
Code Block |
---|
<!-- Defines fields which may be referenced by other model elements--> <fields> <field name="myStringField" type="String" id="10000" length="16" doc="My String field" /> </fields> <messages> <message name="Message" factoryid="1" id="1"> <fieldRef ref="myStringField" name="myField"required="true" /> <field name="myOtherField" type="String" length="16" id=10001" doc="My Other String field" /> </message> </messages> |
Field Attributes
...
The type of the element. If the type is defined in this namespace or is a primitive or collection type, only the simple name of the type need be used. If the type belongs to another namespace from an imported file, then the fully qualified name should be used. The best practice when importing a type from another model is to use the fully qualified name of the imported type (e.g. com.example.importedmodel.MyEntity), as this insulates your model from future conflicts in the event that imported models are changed.
If the field is an array type, it should be suffixed with array indices such as MyEntity[] to denote it as an array.
...
Contains the name of the JSON property that will be used for the field when the message is serialized to JSON. Defaults to using the value defined in name.
...
The id of the field. The id must be unique with the scope of the containing type. For Xbuf/Protobuf encoding this tag is used as the tag value for the field on the wire. If not set, a unique id will be generated by the source code generator. For better control over compatibility, it is recommended that the application set this value manually.
Field ids must be between 0 and 32767 inclusive
...
If this field refers to a variable length type (such as a string), this indicates the maximum length of the field.
...
Note | |||||||
---|---|---|---|---|---|---|---|
| |||||||
It is not possible to define two types with the same name in a given model. One exception to this rule is that it is possible (though strongly discouraged) to define a type with the same name as a built-in type. In this case, using an unqualified type reference will favor the built-in type. In this case, it is possible to reference the local type by using the this keyword, or the fully qualified name:
|
...