Currently the NuxeoConverterFactory owns the static field entityTypeToClass used to determine java type from entity-type field present in JSON response.
This field is static because we need it in EntityValueDeserializer to determine type of fetched/resolved properties and type of context properties.
We want to avoid the static modifier by leveraging Jackson's attributes feature.
We will need to give this Map to Jackson like this:
ObjectReader objectReader = objectMapper.readerFor(javaType); return objectReader.withAttribute("entityTypeToClass", entityTypeToClass).readValue(reader);
And then get it in deserializer like this:
public Object deserialize(JsonParser jp, DeserializationContext ctx) throws IOException { Map<String, Class<?>> entityTypeToClass = (Map<String, Class<?>>) ctx.getAttribute("entityTypeToClass"); ... }