TibrvMsgView.get()

Method

Declaration

java.lang.Object get(
    final java.lang.String fieldName)
  throws TibrvException
java.lang.Object get(
    final int fieldId)
  throws TibrvException
java.lang.Object get(
    final java.lang.String fieldName,
    final int fieldId)
  throws TibrvException

Purpose

Get the value of a specified field from a message view snapshot.

Remarks

Programs specify the field to retrieve using the fieldName and fieldId parameters.

When the field contains a submessage, this method returns a copy of the submessage—that is, a Java message object corresponding to a an independent copy of the submessage in the C environment. You may access its fields as a message object, or you may explicitly extract the submessage into its own message view.

Programs can use a related method to loop through all the fields of a message; to retrieve each field by its integer index number, see TibrvMsg.getFieldByIndex().

Parameter

Description

fieldName

Get a field with this name.

fieldId

Get the field with this identifier.

Field Search Algorithm

This method, and related methods that get fields from message views, use the same algorithm as TibrvMsg.get(). For complete details, see Field Search Algorithm.

Method Forms

With only a field name, find the field by name. If the field name is not present in the message, return null. If several fields with that name are present in the message, this method returns the first one that it finds.

With only a field identifier, find the field with that identifier (since identifiers are unique, the message can contain at most one such field). If the identifier is not present in the message, return null.

With both a field name and a field identifier, search first by identifier, and then by field name. If neither are present in the message, return null. If identifier search succeeds, return the field value. If the name search succeeds, but the actual identifier in the field is non-zero (so it does not match the identifier supplied) then throw a TibrvException with status code TibrvStatus.ID_CONFLICT.

See Also

TibrvMsgView