code: EncodingOptions getEncodingOptions() {
      if (!merge) {
        return UserDataConverter.NO_DELETES;
      } else if (fieldMask == null) {
        return UserDataConverter.ALLOW_ALL_DELETES;
      } else {
        return new EncodingOptions() {
          @Override
          public boolean allowDelete(FieldPath fieldPath) {
            return fieldMask.contains(fieldPath);
          }
  
          @Override
          public boolean allowTransform() {
            return true;
          }
        };
      }
    }
docs: Returns the EncodingOptions to use for a set() call.