The Talon Manual

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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
titleQualifying conflicting type names

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:

Code Block
xml
xml
<model xmlns="http://www.neeveresearch.com/schema/x-adml" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"
       name="Trading" 
       namespace="com.mycompany.trading" 
       defaultFactoryId="100">
       doc="Contains Messages used by the Trading Application">
 
  <import model="../orderprocessing.xml"/>
 
  <!--An unfortunately named entity:-->
  <entity name="Currency" id="1">
    <field name="currencyCode" type="String"/>
  </entity>
 
  <entity name="MyEntity" id="2">
    <!-- 
      Without qualifying the Currency type, the built 
      in Currency type is used, and the generated entity
      will return a java.util.Currency.
    -->
    <field name="javaCurrency" type="Currency" />
    <!-- 
      The 'this' keyword indicates that this is the Currency
      entity defined in this model:
    -->
    <field name="currencyEntity" type="this.Currency"/>
    <!-- 
      Namespace qualifying the typeindicates that this is the Currency
      entity defined in this model:
    -->
    <field name="currencyEntity2" type="com.mycompany.trading.Currency"/>
    <!-- 
      Namespace qualifying the type indicates that this is the Currency
      entity defined in some imported model:
    -->
    <field name="currencyEntity3" type="com.mycompany.orderprocessing.Currency"/>
  </entity>
</model>

...