Skip to content

Commit

Permalink
Add JsonMapper.rebuild() for further 3.x compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 10, 2018
1 parent b360fd4 commit 85f384a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ public static Builder builder(JsonFactory streamFactory) {
return new Builder(new JsonMapper(streamFactory));
}

public JsonMapper.Builder rebuild() {
// 09-Dec-2018, tatu: Not as good as what 3.0 has wrt immutability, but best approximation
// we have for 2.x
return new Builder(this.copy());
}

/*
/**********************************************************
/* Standard method overrides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
import com.fasterxml.jackson.core.json.JsonReadFeature;
import com.fasterxml.jackson.databind.cfg.ContextAttributes;
import com.fasterxml.jackson.databind.deser.DeserializationProblemHandler;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;

public class ObjectReaderTest extends BaseMapTest
{
final ObjectMapper MAPPER = new ObjectMapper();
final JsonMapper MAPPER = JsonMapper.builder().build();

static class POJO {
public Map<String, Object> name;
Expand Down

0 comments on commit 85f384a

Please sign in to comment.