File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,12 @@ To use the Scala Module in Jackson, simply register it with the
40
40
ObjectMapper instance:
41
41
42
42
``` scala
43
+ // With 2.10 and later
44
+ val mapper = JsonMapper .builder()
45
+ .addModule(DefaultScalaModule )
46
+ .build()
47
+
48
+ // versions before 2.10 (also support for later 2.x but not 3.0)
43
49
val mapper = new ObjectMapper ()
44
50
mapper.registerModule(DefaultScalaModule )
45
51
```
@@ -50,11 +56,12 @@ the component traits can be included individually:
50
56
51
57
``` scala
52
58
val module = new OptionModule with TupleModule {}
53
- val mapper = new ObjectMapper ()
54
- mapper.registerModule(module)
59
+ val mapper = JsonMapper .builder()
60
+ .addModule(module)
61
+ .build()
55
62
```
56
63
57
- You can also mixin ` ScalaObjectMapper ` (experimental) to get rich wrappers that automatically
64
+ You can also mixin ` ScalaObjectMapper ` to get rich wrappers that automatically
58
65
convert scala manifests directly into TypeReferences for Jackson to use:
59
66
``` scala
60
67
val mapper = new ObjectMapper () with ScalaObjectMapper
You can’t perform that action at this time.
0 commit comments