Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Let one pass an external ObjectMapper to JacksonRuntime instance
Browse files Browse the repository at this point in the history
Motivation:

JacksonRuntime currently creates it own internal ObjectMapper instance.
This ObjectMapper is used for parsing JSON String an emitting JsonLiteral instances.

Jackson provides lots of features, see https://static.javadoc.io/com.fasterxml.jackson.core/jackson-core/2.9.9/com/fasterxml/jackson/core/JsonParser.Feature.html.
Users might want to provide their own ObjectMapper instance configured for their needs (allowing numeric leading zeros, custom date formats, etc) or simply because they already have an instance and there's no reason the create a second one.

Modification:

Add a new constructor.

Result:

Users can provide their own ObjectMapper instance.
  • Loading branch information
slandelle committed Jun 3, 2019
1 parent 4e10c17 commit 4e94a87
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ public JacksonRuntime() {
}

public JacksonRuntime(RuntimeConfiguration configuration) {
this(configuration, new ObjectMapper());
}

public JacksonRuntime(RuntimeConfiguration configuration, ObjectMapper jsonParser) {
super(configuration);
this.jsonParser = new ObjectMapper();
this.jsonParser = jsonParser;
}

@Override
Expand Down

0 comments on commit 4e94a87

Please sign in to comment.