@Override
  public void toData(DataOutput out,
      SerializationContext context) throws IOException {
    hasDelta = false;
    super.toData(out, context);
    DataSerializer.writeObject(getKey(), out);

    int extraFlags = deserializationPolicy;
    if (bridgeContext != null) {
      extraFlags |= HAS_BRIDGE_CONTEXT;
    }
    if (originalSender != null) {
      extraFlags |= HAS_ORIGINAL_SENDER;
    }
    if (versionTag != null) {
      extraFlags |= HAS_VERSION_TAG;
    }
    out.writeByte(extraFlags);

    DataSerializer.writeObject(getCallbackArg(), out);
    out.writeLong(lastModified);
    out.writeByte(op.ordinal);
    if (bridgeContext != null) {
      DataSerializer.writeObject(bridgeContext, out);
    }
    if (originalSender != null) {
      DataSerializer.writeObject(originalSender, out);
    }
    InternalDataSerializer.invokeToData(eventId, out);

    if (expectedOldValue != null) {
      DataSerializer.writeObject(expectedOldValue, out);
    }
    // this will be on wire for cqs old value generations.
    if (hasOldValue) {
      out.writeByte(oldValueIsSerialized ? 1 : 0);
      byte policy = DistributedCacheOperation.valueIsToDeserializationPolicy(oldValueIsSerialized);
      DistributedCacheOperation.writeValue(policy, getOldValObj(), getOldValueBytes(), out);
    }
    DistributedCacheOperation.writeValue(deserializationPolicy, valObj, getValBytes(),
        out);
    if (event.getDeltaBytes() != null) {
      DataSerializer.writeByteArray(event.getDeltaBytes(), out);
    }
    if (versionTag != null) {
      DataSerializer.writeObject(versionTag, out);
    }
  }
sets the instance variable hasOldValue to the giving boolean value.
geode-core/src/main/java/org/apache/geode/internal/cache/tx/RemotePutMessage.java