@@ -71,8 +71,20 @@ inline fun <reified T> Any?.checkTypeMismatch(): T {
7171 return this
7272}
7373
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+ */
7480inline fun <reified T > ObjectMapper.readValue (jp : JsonParser ): T = readValue(jp, jacksonTypeRef<T >())
7581 .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+ */
7688inline fun <reified T > ObjectMapper.readValues (jp : JsonParser ): MappingIterator <T > {
7789 val values = readValues(jp, jacksonTypeRef<T >())
7890
@@ -81,23 +93,83 @@ inline fun <reified T> ObjectMapper.readValues(jp: JsonParser): MappingIterator<
8193 }
8294}
8395
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+ */
84102inline 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+ */
85109inline 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+ */
86116inline fun <reified T > ObjectMapper.readValue (content : String ): T = readValue(content, jacksonTypeRef<T >())
87117 .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+ */
88124inline 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+ */
89131inline fun <reified T > ObjectMapper.readValue (src : InputStream ): T = readValue(src, jacksonTypeRef<T >())
90132 .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+ */
91139inline fun <reified T > ObjectMapper.readValue (src : ByteArray ): T = readValue(src, jacksonTypeRef<T >())
92140 .checkTypeMismatch()
93141
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+ */
94148inline fun <reified T > ObjectMapper.treeToValue (n : TreeNode ): T = readValue(this .treeAsTokens(n), jacksonTypeRef<T >())
95149 .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+ */
96156inline fun <reified T > ObjectMapper.convertValue (from : Any? ): T = convertValue(from, jacksonTypeRef<T >())
97157 .checkTypeMismatch()
98158
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+ */
99165inline fun <reified T > ObjectReader.readValueTyped (jp : JsonParser ): T = readValue(jp, jacksonTypeRef<T >())
100166 .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+ */
101173inline fun <reified T > ObjectReader.readValuesTyped (jp : JsonParser ): Iterator <T > {
102174 val values = readValues(jp, jacksonTypeRef<T >())
103175
0 commit comments