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

Commit 4e94a87

Browse files
committed
Let one pass an external ObjectMapper to JacksonRuntime instance
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.
1 parent 4e10c17 commit 4e94a87

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jmespath-jackson/src/main/java/io/burt/jmespath/jackson/JacksonRuntime.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ public JacksonRuntime() {
2626
}
2727

2828
public JacksonRuntime(RuntimeConfiguration configuration) {
29+
this(configuration, new ObjectMapper());
30+
}
31+
32+
public JacksonRuntime(RuntimeConfiguration configuration, ObjectMapper jsonParser) {
2933
super(configuration);
30-
this.jsonParser = new ObjectMapper();
34+
this.jsonParser = jsonParser;
3135
}
3236

3337
@Override

0 commit comments

Comments
 (0)