@@ -45,6 +45,16 @@ protected ObjectCodec() { }
45
45
* container ({@link java.util.Collection} or {@link java.util.Map}.
46
46
* The reason is that due to type erasure, key and value types
47
47
* can not be introspected when using this method.
48
+ *
49
+ * @param <T> Nominal parameter for target type
50
+ *
51
+ * @param p Parser to use for decoding content to bind
52
+ * @param valueType Java value type to bind content to
53
+ *
54
+ * @return Value deserialized
55
+ *
56
+ * @throws IOException for low-level read issues, or
57
+ * {@link JsonParseException} for decoding problems
48
58
*/
49
59
public abstract <T > T readValue (JsonParser p , Class <T > valueType )
50
60
throws IOException ;
@@ -55,6 +65,16 @@ public abstract <T> T readValue(JsonParser p, Class<T> valueType)
55
65
* "super type token"
56
66
* and specifically needs to be used if the root type is a
57
67
* parameterized (generic) container type.
68
+ *
69
+ * @param <T> Nominal parameter for target type
70
+ *
71
+ * @param p Parser to use for decoding content to bind
72
+ * @param valueTypeRef Java value type to bind content to
73
+ *
74
+ * @return Value deserialized
75
+ *
76
+ * @throws IOException for low-level read issues, or
77
+ * {@link JsonParseException} for decoding problems
58
78
*/
59
79
public abstract <T > T readValue (JsonParser p , TypeReference <T > valueTypeRef )
60
80
throws IOException ;
@@ -64,27 +84,67 @@ public abstract <T> T readValue(JsonParser p, TypeReference<T> valueTypeRef)
64
84
* with fully resolved type object (so it can be a generic type,
65
85
* including containers like {@link java.util.Collection} and
66
86
* {@link java.util.Map}).
87
+ *
88
+ * @param <T> Nominal parameter for target type
89
+ *
90
+ * @param p Parser to use for decoding content to bind
91
+ * @param valueType Java value type to bind content to
92
+ *
93
+ * @return Value deserialized
94
+ *
95
+ * @throws IOException for low-level read issues, or
96
+ * {@link JsonParseException} for decoding problems
67
97
*/
68
98
public abstract <T > T readValue (JsonParser p , ResolvedType valueType )
69
99
throws IOException ;
70
100
71
101
/**
72
102
* Method for reading sequence of Objects from parser stream,
73
103
* all with same specified value type.
104
+ *
105
+ * @param <T> Nominal parameter for target type
106
+ *
107
+ * @param p Parser to use for decoding content to bind
108
+ * @param valueType Java value type to bind content to
109
+ *
110
+ * @return Iterator for incrementally deserializing values
111
+ *
112
+ * @throws IOException for low-level read issues, or
113
+ * {@link JsonParseException} for decoding problems
74
114
*/
75
115
public abstract <T > Iterator <T > readValues (JsonParser p , Class <T > valueType )
76
116
throws IOException ;
77
117
78
118
/**
79
119
* Method for reading sequence of Objects from parser stream,
80
120
* all with same specified value type.
121
+ *
122
+ * @param <T> Nominal parameter for target type
123
+ *
124
+ * @param p Parser to use for decoding content to bind
125
+ * @param valueTypeRef Java value type to bind content to
126
+ *
127
+ * @return Iterator for incrementally deserializing values
128
+ *
129
+ * @throws IOException for low-level read issues, or
130
+ * {@link JsonParseException} for decoding problems
81
131
*/
82
132
public abstract <T > Iterator <T > readValues (JsonParser p , TypeReference <T > valueTypeRef )
83
133
throws IOException ;
84
134
85
135
/**
86
136
* Method for reading sequence of Objects from parser stream,
87
137
* all with same specified value type.
138
+ *
139
+ * @param <T> Nominal parameter for target type
140
+ *
141
+ * @param p Parser to use for decoding content to bind
142
+ * @param valueType Java value type to bind content to
143
+ *
144
+ * @return Iterator for incrementally deserializing values
145
+ *
146
+ * @throws IOException for low-level read issues, or
147
+ * {@link JsonParseException} for decoding problems
88
148
*/
89
149
public abstract <T > Iterator <T > readValues (JsonParser p , ResolvedType valueType )
90
150
throws IOException ;
@@ -98,6 +158,12 @@ public abstract <T> Iterator<T> readValues(JsonParser p, ResolvedType valueType)
98
158
/**
99
159
* Method to serialize given Java Object, using generator
100
160
* provided.
161
+ *
162
+ * @param gen Generator to use for serializing value
163
+ * @param value Value to serialize
164
+ *
165
+ * @throws IOException for low-level write issues, or
166
+ * {@link JsonGenerationException} for decoding problems
101
167
*/
102
168
public abstract void writeValue (JsonGenerator gen , Object value ) throws IOException ;
103
169
@@ -108,31 +174,48 @@ public abstract <T> Iterator<T> readValues(JsonParser p, ResolvedType valueType)
108
174
*/
109
175
110
176
/**
111
- * Method to deserialize JSON content as tree expressed
177
+ * Method for deserializing JSON content as tree expressed
112
178
* using set of {@link TreeNode} instances. Returns
113
179
* root of the resulting tree (where root can consist
114
180
* of just a single node if the current event is a
115
181
* value event, not container). Empty or whitespace
116
182
* documents return null.
117
183
*
118
- * @return next tree from p, or null if empty.
184
+ * @return next tree from {@code p}, or {@code null} if empty.
185
+ *
186
+ * @throws IOException for low-level read issues, or
187
+ * {@link JsonParseException} for decoding problems
119
188
*/
120
189
@ Override
121
190
public abstract <T extends TreeNode > T readTree (JsonParser p ) throws IOException ;
122
-
191
+
192
+ /**
193
+ * Method for serializing JSON content from given Tree instance, using
194
+ * specified generator.
195
+ *
196
+ * @param gen Generator to use for serializing value
197
+ * @param tree Tree to serialize
198
+ *
199
+ * @throws IOException for low-level write issues, or
200
+ * {@link JsonGenerationException} for decoding problems
201
+ */
123
202
@ Override
124
203
public abstract void writeTree (JsonGenerator gen , TreeNode tree ) throws IOException ;
125
204
126
205
/**
127
206
* Method for construct root level Object nodes
128
207
* for Tree Model instances.
208
+ *
209
+ * @return Object node created
129
210
*/
130
211
@ Override
131
212
public abstract TreeNode createObjectNode ();
132
213
133
214
/**
134
215
* Method for construct root level Array nodes
135
216
* for Tree Model instances.
217
+ *
218
+ * @return Array node created
136
219
*/
137
220
@ Override
138
221
public abstract TreeNode createArrayNode ();
@@ -141,6 +224,10 @@ public abstract <T> Iterator<T> readValues(JsonParser p, ResolvedType valueType)
141
224
* Method for constructing a {@link JsonParser} for reading
142
225
* contents of a JSON tree, as if it was external serialized
143
226
* JSON content.
227
+ *
228
+ * @param n Content to traverse over
229
+ *
230
+ * @return Parser constructed for traversing over contents of specified node
144
231
*/
145
232
@ Override
146
233
public abstract JsonParser treeAsTokens (TreeNode n );
@@ -155,6 +242,15 @@ public abstract <T> Iterator<T> readValues(JsonParser p, ResolvedType valueType)
155
242
* Convenience method for converting given JSON tree into instance of specified
156
243
* value type. This is equivalent to first constructing a {@link JsonParser} to
157
244
* iterate over contents of the tree, and using that parser for data binding.
245
+ *
246
+ * @param <T> Nominal parameter for target type
247
+ *
248
+ * @param n Tree to convert
249
+ * @param valueType Java target value type to convert content to
250
+ *
251
+ * @return Converted value instance
252
+ *
253
+ * @throws JsonProcessingException if structural conversion fails
158
254
*/
159
255
public abstract <T > T treeToValue (TreeNode n , Class <T > valueType )
160
256
throws JsonProcessingException ;
@@ -166,16 +262,18 @@ public abstract <T> T treeToValue(TreeNode n, Class<T> valueType)
166
262
*/
167
263
168
264
/**
169
- * @deprecated Since 2.1: Use {@link #getFactory} instead.
265
+ * @deprecated Use {@link #getFactory} instead.
266
+ *
267
+ * @return Underlying {@link JsonFactory} instance
170
268
*/
171
269
@ Deprecated
172
270
public JsonFactory getJsonFactory () { return getFactory (); }
173
271
174
272
/**
175
273
* Accessor for finding underlying data format factory
176
274
* ({@link JsonFactory}) codec will use for data binding.
177
- *
178
- * @since 2.1
275
+ *
276
+ * @return Underlying {@link JsonFactory} instance
179
277
*/
180
278
public JsonFactory getFactory () { return getJsonFactory (); }
181
279
}
0 commit comments