Table of contents

 

In certain cases, the Message Template itself can indicate that field values are required in the encoded stream.  In cases where a field value is required, no Presence Map (PMap) bit is allocated for the field.  This section describes those circumstances where a PMap bit is and is not required.

A field does not require a PMap bit if the field value must always be present in the encoded message. (This is not related to whether a value is nullable.) If the field value must be present, then the no PMap bit is required or allocated and we always decode field value from the input encoded message. Otherwise, we decode field values from the input encoded message based on the PMap bit value ('1' or '0'). 

Table 3.1 shows the requirement for a PMap bit based on Operator type and the Presence property of the field (optional or mandatory).

Table 3.1

Operation Mandatory Optional
NoOperator - -
Constant - required 
Copy required required 
Default required required 
Delta - -
Increment required required 
Tail required required 

In our code, each template field entity object should implement the following method for defining requirement of presence bit value in the PMap:

 
public boolean isPMapBitExist(); 

Here is an example using this method:

public int decode(byte[] encodedData, int offset, 
                  PresenceMap presenceMap, OutputMessage message) {
    if (isPMapBitExist()) {
        boolean presenceBit = presenceMap.isNextPMapBitSet();
        ...