Skip to content

Commit 95e5b92

Browse files
committed
Merge remote-tracking branch 'origin/2.13' into novtor/2.13
Conflicts: pom.xml
2 parents aaee7fb + 8128f97 commit 95e5b92

29 files changed

+2672
-159
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ orbs:
33
maven: circleci/maven@1.0.2
44
workflows:
55
maven_test:
6+
when: false
67
jobs:
78
- maven/test

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Kotlin](https://img.shields.io/badge/kotlin-1.5.x-blue.svg)](http://kotlinlang.org) [![CircleCI](https://circleci.com/gh/FasterXML/jackson-module-kotlin.svg?style=svg)](https://circleci.com/gh/FasterXML/jackson-module-kotlin) [![Kotlin Slack](https://img.shields.io/badge/chat-kotlin%20slack-orange.svg)](http://slack.kotlinlang.org/)
1+
[![Kotlin](https://img.shields.io/badge/kotlin-1.5.x-blue.svg)](http://kotlinlang.org) [![Kotlin Slack](https://img.shields.io/badge/chat-kotlin%20slack-orange.svg)](http://slack.kotlinlang.org/)
22

33
# Overview
44

@@ -10,7 +10,7 @@ and those with secondary constructors or static factories are also supported.
1010

1111
# Status
1212

13-
* release `2.13.0` (for Jackson `2.13.x`) [![CircleCI](https://circleci.com/gh/FasterXML/jackson-module-kotlin/tree/2.12.svg?style=svg)](https://circleci.com/gh/FasterXML/jackson-module-kotlin/tree/2.13)
13+
* release `2.13.0` (for Jackson `2.13.x`) [![GitHub Actions build](https://github.com/FasterXML/jackson-module-kotlin/actions/workflows/main.yml/badge.svg?branch=2.13)](https://github.com/FasterXML/jackson-module-kotlin/actions?query=branch%3A2.13)
1414
* release `2.12.3` (for Jackson `2.12.x`) [![CircleCI](https://circleci.com/gh/FasterXML/jackson-module-kotlin/tree/2.12.svg?style=svg)](https://circleci.com/gh/FasterXML/jackson-module-kotlin/tree/2.12)
1515
* release `2.11.4` (for Jackson `2.11.x`) [![CircleCI](https://circleci.com/gh/FasterXML/jackson-module-kotlin/tree/2.11.svg?style=svg)](https://circleci.com/gh/FasterXML/jackson-module-kotlin/tree/2.11)
1616
* release `2.10.5` (for Jackson `2.10.x`)
@@ -100,6 +100,30 @@ myMemberWithType = mapper.readValue(json)
100100
All inferred types for the extension functions carry in full generic information (reified generics).
101101
Therefore, using `readValue()` extension without the `Class` parameter will reify the type and automatically create a `TypeReference` for Jackson.
102102

103+
Also, there are some convenient operator overloading extension functions for JsonNode inheritors.
104+
```kotlin
105+
import com.fasterxml.jackson.databind.node.ArrayNode
106+
import com.fasterxml.jackson.databind.node.ObjectNode
107+
import com.fasterxml.jackson.databind.node.JsonNodeFactory
108+
import com.fasterxml.jackson.module.kotlin.*
109+
110+
// ...
111+
val objectNode: ObjectNode = JsonNodeFactory.instance.objectNode()
112+
objectNode.put("foo1", "bar").put("foo2", "baz").put("foo3", "bax")
113+
objectNode -= "foo1"
114+
objectNode -= listOf("foo2")
115+
println(objectNode.toString()) // {"foo3":"bax"}
116+
117+
// ...
118+
val arrayNode: ArrayNode = JsonNodeFactory.instance.arrayNode()
119+
arrayNode += "foo"
120+
arrayNode += true
121+
arrayNode += 1
122+
arrayNode += 1.0
123+
arrayNode += "bar".toByteArray()
124+
println(arrayNode.toString()) // ["foo",true,1,1.0,"YmFy"]
125+
```
126+
103127
# Annotations
104128

105129
You can intermix non-field values in the constructor and `JsonProperty` annotation in the constructor.
@@ -124,6 +148,7 @@ Note that using `lateinit` or `Delegates.notNull()` will ensure that the value i
124148
* If using proguard:
125149
* `kotlin.Metadata` annotations may be stripped, preventing deserialization. Add a proguard rule to keep the `kotlin.Metadata` class: `-keep class kotlin.Metadata { *; }`
126150
* If you're getting `java.lang.ExceptionInInitializerError`, you may also need: `-keep class kotlin.reflect.** { *; }`
151+
* If you're still running into problems, you might also need to add a proguard keep rule for the specific classes you want to (de-)serialize. For example, if all your models are inside the package `com.example.models`, you could add the rule `-keep class com.example.models.** { *; }`
127152

128153
# Support for Kotlin Built-in classes
129154

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<!-- NewPage -->
3+
<html lang="en">
4+
<head>
5+
<!-- Generated by javadoc (1.8.0_272) on Thu Sep 30 15:55:41 PDT 2021 -->
6+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7+
<title>All Classes (jackson-module-kotlin 2.13.0 API)</title>
8+
<meta name="date" content="2021-09-30">
9+
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
10+
<script type="text/javascript" src="script.js"></script>
11+
</head>
12+
<body>
13+
<h1 class="bar">All&nbsp;Classes</h1>
14+
<div class="indexContainer">
15+
<ul>
16+
<li><a href="com/fasterxml/jackson/module/kotlin/PackageVersion.html" title="class in com.fasterxml.jackson.module.kotlin" target="classFrame">PackageVersion</a></li>
17+
</ul>
18+
</div>
19+
</body>
20+
</html>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<!-- NewPage -->
3+
<html lang="en">
4+
<head>
5+
<!-- Generated by javadoc (1.8.0_272) on Thu Sep 30 15:55:41 PDT 2021 -->
6+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7+
<title>All Classes (jackson-module-kotlin 2.13.0 API)</title>
8+
<meta name="date" content="2021-09-30">
9+
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
10+
<script type="text/javascript" src="script.js"></script>
11+
</head>
12+
<body>
13+
<h1 class="bar">All&nbsp;Classes</h1>
14+
<div class="indexContainer">
15+
<ul>
16+
<li><a href="com/fasterxml/jackson/module/kotlin/PackageVersion.html" title="class in com.fasterxml.jackson.module.kotlin">PackageVersion</a></li>
17+
</ul>
18+
</div>
19+
</body>
20+
</html>

0 commit comments

Comments
 (0)