@@ -71,8 +71,20 @@ inline fun <reified T> Any?.checkTypeMismatch(): T {
71
71
return this
72
72
}
73
73
74
+ /* *
75
+ * Shorthand for [ObjectMapper.readValue].
76
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
77
+ * Other cases where the read value is of a different type than [T]
78
+ * due to an incorrect customization to [ObjectMapper].
79
+ */
74
80
inline fun <reified T > ObjectMapper.readValue (jp : JsonParser ): T = readValue(jp, jacksonTypeRef<T >())
75
81
.checkTypeMismatch()
82
+ /* *
83
+ * Shorthand for [ObjectMapper.readValues].
84
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
85
+ * Other cases where the read value is of a different type than [T]
86
+ * due to an incorrect customization to [ObjectMapper].
87
+ */
76
88
inline fun <reified T > ObjectMapper.readValues (jp : JsonParser ): MappingIterator <T > {
77
89
val values = readValues(jp, jacksonTypeRef<T >())
78
90
@@ -81,23 +93,83 @@ inline fun <reified T> ObjectMapper.readValues(jp: JsonParser): MappingIterator<
81
93
}
82
94
}
83
95
96
+ /* *
97
+ * Shorthand for [ObjectMapper.readValue].
98
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
99
+ * Other cases where the read value is of a different type than [T]
100
+ * due to an incorrect customization to [ObjectMapper].
101
+ */
84
102
inline fun <reified T > ObjectMapper.readValue (src : File ): T = readValue(src, jacksonTypeRef<T >()).checkTypeMismatch()
103
+ /* *
104
+ * Shorthand for [ObjectMapper.readValue].
105
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
106
+ * Other cases where the read value is of a different type than [T]
107
+ * due to an incorrect customization to [ObjectMapper].
108
+ */
85
109
inline fun <reified T > ObjectMapper.readValue (src : URL ): T = readValue(src, jacksonTypeRef<T >()).checkTypeMismatch()
110
+ /* *
111
+ * Shorthand for [ObjectMapper.readValue].
112
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
113
+ * Other cases where the read value is of a different type than [T]
114
+ * due to an incorrect customization to [ObjectMapper].
115
+ */
86
116
inline fun <reified T > ObjectMapper.readValue (content : String ): T = readValue(content, jacksonTypeRef<T >())
87
117
.checkTypeMismatch()
118
+ /* *
119
+ * Shorthand for [ObjectMapper.readValue].
120
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
121
+ * Other cases where the read value is of a different type than [T]
122
+ * due to an incorrect customization to [ObjectMapper].
123
+ */
88
124
inline fun <reified T > ObjectMapper.readValue (src : Reader ): T = readValue(src, jacksonTypeRef<T >()).checkTypeMismatch()
125
+ /* *
126
+ * Shorthand for [ObjectMapper.readValue].
127
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
128
+ * Other cases where the read value is of a different type than [T]
129
+ * due to an incorrect customization to [ObjectMapper].
130
+ */
89
131
inline fun <reified T > ObjectMapper.readValue (src : InputStream ): T = readValue(src, jacksonTypeRef<T >())
90
132
.checkTypeMismatch()
133
+ /* *
134
+ * Shorthand for [ObjectMapper.readValue].
135
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
136
+ * Other cases where the read value is of a different type than [T]
137
+ * due to an incorrect customization to [ObjectMapper].
138
+ */
91
139
inline fun <reified T > ObjectMapper.readValue (src : ByteArray ): T = readValue(src, jacksonTypeRef<T >())
92
140
.checkTypeMismatch()
93
141
142
+ /* *
143
+ * Shorthand for [ObjectMapper.readValue].
144
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
145
+ * Other cases where the read value is of a different type than [T]
146
+ * due to an incorrect customization to [ObjectMapper].
147
+ */
94
148
inline fun <reified T > ObjectMapper.treeToValue (n : TreeNode ): T = readValue(this .treeAsTokens(n), jacksonTypeRef<T >())
95
149
.checkTypeMismatch()
150
+ /* *
151
+ * Shorthand for [ObjectMapper.convertValue].
152
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
153
+ * Other cases where the read value is of a different type than [T]
154
+ * due to an incorrect customization to [ObjectMapper].
155
+ */
96
156
inline fun <reified T > ObjectMapper.convertValue (from : Any? ): T = convertValue(from, jacksonTypeRef<T >())
97
157
.checkTypeMismatch()
98
158
159
+ /* *
160
+ * Shorthand for [ObjectMapper.readValue].
161
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
162
+ * Other cases where the read value is of a different type than [T]
163
+ * due to an incorrect customization to [ObjectMapper].
164
+ */
99
165
inline fun <reified T > ObjectReader.readValueTyped (jp : JsonParser ): T = readValue(jp, jacksonTypeRef<T >())
100
166
.checkTypeMismatch()
167
+ /* *
168
+ * Shorthand for [ObjectMapper.readValues].
169
+ * @throws RuntimeJsonMappingException Especially if [T] is non-null and the value read is null.
170
+ * Other cases where the read value is of a different type than [T]
171
+ * due to an incorrect customization to [ObjectMapper].
172
+ */
101
173
inline fun <reified T > ObjectReader.readValuesTyped (jp : JsonParser ): Iterator <T > {
102
174
val values = readValues(jp, jacksonTypeRef<T >())
103
175
0 commit comments