Skip to content

Add support for custom ObjectMapper in DocumentClient #85

@qwazer

Description

@qwazer

In azure-documentdb-1.13.0.jar objectMapper is not configurable and created for every save operation

decompiled code:

 private static String serializeProcedureParams(Object[] objectArray) {
        ObjectMapper mapper = null;
        String[] stringArray = new String[objectArray.length];

        for(int i = 0; i < objectArray.length; ++i) {
            Object object = objectArray[i];
            if (object instanceof JsonSerializable) {
                stringArray[i] = ((JsonSerializable)object).toJson();
            } else if (object instanceof JSONObject) {
                stringArray[i] = object.toString();
            } else {
                if (mapper == null) {
                    mapper = new ObjectMapper();
                }

                try {
                    stringArray[i] = mapper.writeValueAsString(object);
                } catch (IOException var6) {
                    throw new IllegalArgumentException("Can't serialize the object into the json string", var6);
                }
            }
        }

        return String.format("[%s]", StringUtils.join(stringArray, ","));
    }

Please fix performance issue and add ability to use custom object mapper

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions