appendBodyTuple

appendBodyTuple(tuplename: String;
                value:     Any);

The appendBodyTuple method of the JadeGenericMessage class adds a tuple to the end of the message body. A tuple has a name, a type, and a single primitive value. The tuplename parameter, which is case-sensitive, must start with a letter. The subsequent characters to a maximum of 89 characters can be letters, digits, underscores, or periods.

The body property of the message must be empty before the appendBodyTuple method is called for the first time. A partially built message can be discarded by calling the initializeForPut method.

In the following example of sending of tuple data, a message containing the name and the shoe size of a person is constructed.

msg.appendBodyTuple("name", "wilbur");
msg.appendBodyTuple("shoe_size", 6.5);

The first tuple that is appended has a value for the tuplename parameter of "name", a value for the value parameter of "wilbur", and the type of data is String. The second tuple has a value for the tuplename parameter of "shoe_size", a value for the value parameter of 6.5, and the type of data is Real.

No check is made to determine if a tuple is already present with the same name. When the message is read using the getBodyTuple method, only the first tuple in the message with a matching name is returned; all other duplicates are ignored.

A message can be constructed by calling the appendBodyTuple method a number of times. If you call the appendBodyTuple method before or after calling and appendBinary, appendStringUtf8, appendString, or appendStringAsUtf8 methods or directly assigning a value to the body property, an exception is raised.

The format property of the message is automatically set to "JadeTpls".

Take care when using this mechanism to send an object reference to another process.