Coding and accessing messages with repeating structures

Messages with repeating structures can be defined by using the DLITypeInfoList class. With the DLITypeInfoList class, you can specify a repeating list of fields and the maximum number of times the list can be repeated. These repeating structures can contain repeating structures.

The following code example is a sample output message that contains a set of Make, Model, and Color fields:

Sample output message with repeating structures

public class ModelOutput extends IMSFieldMessage {
static DLITypeInfo[] modelTypeInfo = { 
     new DLITypeInfo("Make", DLITypeInfo.CHAR, 1, 20),
     new DLITypeInfo("Model", DLITypeInfo.CHAR, 21, 20),
     new DLITypeInfo("Color", DLITypeInfo.CHAR, 41, 20), 
     };
static DLITypeInfo[] modelTypeInfoList = { 
     new DLITypeInfoList("Models", modelTypeInfo, 1, 60, 100),
     };
public ModelOutput() { 
   super(modelTypeInfoList, 6004, false);
} }
To access the nested structures that are defined in a DLITypeInfoList object, use a dotted notation to specify the fields of the field within a repeating structure. For example, the Color field in the fourth Models definition in the output object is accessed as Models.4.Color within the output message. The following code sets the fourth Color in the output message to Red.
IOMessage output = app.getIOMessage("class://ModelOutput");
output.setString("Models.4.Color", "Red");