TibrvMsg.getFieldInstance()
Method
Declaration
TibrvMsgFieldgetFieldInstance
(
java.lang.String fieldName,
int instance)
throws TibrvException
Purpose
Get a specific instance of a field from a message.
Remarks
When a message contains several field instances with the same field name, retrieve a specific instance by number (for example, get the i
th field named foo
). Programs can use this method in a loop that examines every field with a specified name.
The argument 1
denotes the first instance of the named field.
The method takes a snapshot of the field, and returns that information as a field object.
The method copies scalar data into the field object. Non-scalar data extracted from the field remain valid until the message is destroyed; that is, even removing the field or updating the field’s value does not invalidate non-scalar data (such as arrays, strings, submessages, XML data, or opaque byte sequences).
When the instance
argument is greater than the actual number of instances of the field in the message, this method returns null
.
Release 5 Interaction
Rendezvous 5 (and earlier) did not support array datatypes. Some older programs circumvented this limitation by using several fields with the same name to simulate arrays. This work-around is no longer necessary, since release 6 (and later) supports array datatypes within message fields. The method TibrvMsg.getFieldInstance() ensures backward compatibility, so new programs can still receive and manipulate messages sent from older programs. Nonetheless, we encourage programmers to use array types as appropriate, and we discourage storing several fields with the same name in a message.
Parameter |
Description |
|
Get an instance of the field with this name.
|
|
Get this instance of the specified field name. The argument |