You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-8Lines changed: 14 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,18 @@
2
2
3
3
# Overview
4
4
5
-
Module that adds support for serialization/deserialization of [Kotlin](http://kotlinlang.org) classes and data classes. Previously a default constructor must have existed on the Kotlin object for Jackson to deserialize into the object. With this module, single constructor classes can be used automatically, and those with secondary constructors or static factories are also supported.
5
+
Module that adds support for serialization/deserialization of [Kotlin](http://kotlinlang.org) classes and data classes.
6
+
Previously a default constructor must have existed on the Kotlin object for Jackson to deserialize into the object.
7
+
With this module, single constructor classes can be used automatically, and those with secondary constructors or static factories are also supported.
2.9.8+ Releases are compiled with Kotlin 1.3.x, other older releases are Kotlin 1.2.x. All should be compatible with
12
-
current Kotlin if you also ensure the `kotlin-reflect`depedency is included with the same version number as stdlib.
14
+
current Kotlin if you also ensure the `kotlin-reflect`dependency is included with the same version number as stdlib.
13
15
14
-
* release `2.10.10` (for Jackson `2.10.x`)
16
+
* release `2.10.2` (for Jackson `2.10.x`)
15
17
* release `2.9.10` (for Jackson `2.9.x`)
16
18
* release `2.8.11.1` (for Jackson `2.8.x`)
17
19
* release `2.7.9.1` (for Jackson `2.7.x`) lacking in some new features from 2.8 branch
@@ -28,7 +30,7 @@ Maven:
28
30
<dependency>
29
31
<groupId>com.fasterxml.jackson.module</groupId>
30
32
<artifactId>jackson-module-kotlin</artifactId>
31
-
<version>2.10.10</version>
33
+
<version>2.10.2</version>
32
34
</dependency>
33
35
```
34
36
@@ -73,7 +75,9 @@ Therefore using `readValue()` extension without the `Class` parameter will reify
73
75
74
76
# Annotations
75
77
76
-
You can intermix non-field values in the constructor and `JsonProperty` annotation in the constructor. Any fields not present in the constructor will be set after the constructor call. An example of these concepts:
78
+
You can intermix non-field values in the constructor and `JsonProperty` annotation in the constructor.
79
+
Any fields not present in the constructor will be set after the constructor call.
80
+
An example of these concepts:
77
81
78
82
```kotlin
79
83
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@@ -84,13 +88,15 @@ You can intermix non-field values in the constructor and `JsonProperty` annotati
84
88
}
85
89
```
86
90
87
-
Note that using `lateinit` or `Delegates.notNull()` will ensure that the value is never null when read, while letting it be instantiated after the construction of the class.
91
+
Note that using `lateinit` or `Delegates.notNull()` will ensure that the value is never `null` when read, while letting it be instantiated after the construction of the class.
88
92
89
93
# Caveats
90
94
91
-
* The `@JsonCreator` annotation is optional unless you have more than one constructor that is valid, or you want to use a static factory method (which also must have `platformStatic` annotation). In these cases, annotate only one method as `JsonCreator`.
95
+
* The `@JsonCreator` annotation is optional unless you have more than one constructor that is valid, or you want to use a static factory method (which also must have `platformStatic` annotation). In these cases, annotate only one method as `JsonCreator`.
92
96
* Serializing a member or top-level Kotlin class that implements Iterator requires a workaround, see [Issue #4](https://github.com/FasterXML/jackson-module-kotlin/issues/4) for easy workarounds.
93
-
* If using proguard, `kotlin.Metadata` annotations may be stripped, preventing deserialization. Add a proguard rule to keep the `kotlin.Metadata` class: `-keep class kotlin.Metadata { *; }`
97
+
* If using proguard:
98
+
*`kotlin.Metadata` annotations may be stripped, preventing deserialization. Add a proguard rule to keep the `kotlin.Metadata` class: `-keep class kotlin.Metadata { *; }`
99
+
* If you're getting `java.lang.ExceptionInInitializerError`, you may also need: `-keep class kotlin.reflect.** { *; }`
<li><ahref="com/fasterxml/jackson/module/kotlin/PackageVersion.html" title="class in com.fasterxml.jackson.module.kotlin" target="classFrame">PackageVersion</a></li>
0 commit comments