@@ -135,58 +135,87 @@ public void writeStartArray() throws IOException
135
135
{
136
136
// First things first: whole-sale skipping easy
137
137
if (_itemFilter == null ) {
138
- _filterContext = _filterContext .createChildArrayContext (null , false );
138
+ _filterContext = _filterContext .createChildArrayContext (null , null , false );
139
139
return ;
140
140
}
141
141
if (_itemFilter == TokenFilter .INCLUDE_ALL ) { // include the whole sub-tree?
142
- _filterContext = _filterContext .createChildArrayContext (_itemFilter , true );
142
+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , null , true );
143
143
delegate .writeStartArray ();
144
144
return ;
145
145
}
146
146
// Ok; regular checking state then
147
147
_itemFilter = _filterContext .checkValue (_itemFilter );
148
148
if (_itemFilter == null ) {
149
- _filterContext = _filterContext .createChildArrayContext (null , false );
149
+ _filterContext = _filterContext .createChildArrayContext (null , null , false );
150
150
return ;
151
151
}
152
152
if (_itemFilter != TokenFilter .INCLUDE_ALL ) {
153
153
_itemFilter = _itemFilter .filterStartArray ();
154
154
}
155
155
if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
156
156
_checkParentPath ();
157
- _filterContext = _filterContext .createChildArrayContext (_itemFilter , true );
157
+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , null , true );
158
158
delegate .writeStartArray ();
159
159
} else {
160
- _filterContext = _filterContext .createChildArrayContext (_itemFilter , false );
160
+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , null , false );
161
161
}
162
162
}
163
-
163
+
164
+ @ Override
165
+ public void writeStartArray (Object currValue ) throws IOException
166
+ {
167
+ if (_itemFilter == null ) {
168
+ _filterContext = _filterContext .createChildArrayContext (null , currValue , false );
169
+ return ;
170
+ }
171
+ if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
172
+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , currValue , true );
173
+ delegate .writeStartArray (currValue );
174
+ return ;
175
+ }
176
+ _itemFilter = _filterContext .checkValue (_itemFilter );
177
+ if (_itemFilter == null ) {
178
+ _filterContext = _filterContext .createChildArrayContext (null , currValue , false );
179
+ return ;
180
+ }
181
+ if (_itemFilter != TokenFilter .INCLUDE_ALL ) {
182
+ _itemFilter = _itemFilter .filterStartArray ();
183
+ }
184
+ if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
185
+ _checkParentPath ();
186
+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , currValue , true );
187
+ delegate .writeStartArray (currValue );
188
+ } else {
189
+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , currValue , false );
190
+ }
191
+ }
192
+
164
193
@ Override
165
- public void writeStartArray (int size ) throws IOException
194
+ public void writeStartArray (Object currValue , int size ) throws IOException
166
195
{
167
196
if (_itemFilter == null ) {
168
- _filterContext = _filterContext .createChildArrayContext (null , false );
197
+ _filterContext = _filterContext .createChildArrayContext (null , currValue , false );
169
198
return ;
170
199
}
171
200
if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
172
- _filterContext = _filterContext .createChildArrayContext (_itemFilter , true );
173
- delegate .writeStartArray (size );
201
+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , currValue , true );
202
+ delegate .writeStartArray (currValue , size );
174
203
return ;
175
204
}
176
205
_itemFilter = _filterContext .checkValue (_itemFilter );
177
206
if (_itemFilter == null ) {
178
- _filterContext = _filterContext .createChildArrayContext (null , false );
207
+ _filterContext = _filterContext .createChildArrayContext (null , currValue , false );
179
208
return ;
180
209
}
181
210
if (_itemFilter != TokenFilter .INCLUDE_ALL ) {
182
211
_itemFilter = _itemFilter .filterStartArray ();
183
212
}
184
213
if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
185
214
_checkParentPath ();
186
- _filterContext = _filterContext .createChildArrayContext (_itemFilter , true );
187
- delegate .writeStartArray (size );
215
+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , currValue , true );
216
+ delegate .writeStartArray (currValue , size );
188
217
} else {
189
- _filterContext = _filterContext .createChildArrayContext (_itemFilter , false );
218
+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , currValue , false );
190
219
}
191
220
}
192
221
@@ -204,11 +233,11 @@ public void writeEndArray() throws IOException
204
233
public void writeStartObject () throws IOException
205
234
{
206
235
if (_itemFilter == null ) {
207
- _filterContext = _filterContext .createChildObjectContext (_itemFilter , false );
236
+ _filterContext = _filterContext .createChildObjectContext (_itemFilter , null , false );
208
237
return ;
209
238
}
210
239
if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
211
- _filterContext = _filterContext .createChildObjectContext (_itemFilter , true );
240
+ _filterContext = _filterContext .createChildObjectContext (_itemFilter , null , true );
212
241
delegate .writeStartObject ();
213
242
return ;
214
243
}
@@ -223,23 +252,53 @@ public void writeStartObject() throws IOException
223
252
}
224
253
if (f == TokenFilter .INCLUDE_ALL ) {
225
254
_checkParentPath ();
226
- _filterContext = _filterContext .createChildObjectContext (f , true );
255
+ _filterContext = _filterContext .createChildObjectContext (f , null , true );
227
256
delegate .writeStartObject ();
228
257
} else { // filter out
229
- _filterContext = _filterContext .createChildObjectContext (f , false );
258
+ _filterContext = _filterContext .createChildObjectContext (f , null , false );
230
259
}
231
260
}
232
-
261
+
262
+ @ Override
263
+ public void writeStartObject (Object currValue ) throws IOException
264
+ {
265
+ if (_itemFilter == null ) {
266
+ _filterContext = _filterContext .createChildObjectContext (_itemFilter , currValue , false );
267
+ return ;
268
+ }
269
+ if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
270
+ _filterContext = _filterContext .createChildObjectContext (_itemFilter , currValue , true );
271
+ delegate .writeStartObject (currValue );
272
+ return ;
273
+ }
274
+
275
+ TokenFilter f = _filterContext .checkValue (_itemFilter );
276
+ if (f == null ) {
277
+ return ;
278
+ }
279
+
280
+ if (f != TokenFilter .INCLUDE_ALL ) {
281
+ f = f .filterStartObject ();
282
+ }
283
+ if (f == TokenFilter .INCLUDE_ALL ) {
284
+ _checkParentPath ();
285
+ _filterContext = _filterContext .createChildObjectContext (f , currValue , true );
286
+ delegate .writeStartObject (currValue );
287
+ } else { // filter out
288
+ _filterContext = _filterContext .createChildObjectContext (f , currValue , false );
289
+ }
290
+ }
291
+
233
292
@ Override
234
- public void writeStartObject (Object forValue ) throws IOException
293
+ public void writeStartObject (Object currValue , int size ) throws IOException
235
294
{
236
295
if (_itemFilter == null ) {
237
- _filterContext = _filterContext .createChildObjectContext (_itemFilter , false );
296
+ _filterContext = _filterContext .createChildObjectContext (_itemFilter , currValue , false );
238
297
return ;
239
298
}
240
299
if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
241
- _filterContext = _filterContext .createChildObjectContext (_itemFilter , true );
242
- delegate .writeStartObject (forValue );
300
+ _filterContext = _filterContext .createChildObjectContext (_itemFilter , currValue , true );
301
+ delegate .writeStartObject (currValue , size );
243
302
return ;
244
303
}
245
304
@@ -253,10 +312,10 @@ public void writeStartObject(Object forValue) throws IOException
253
312
}
254
313
if (f == TokenFilter .INCLUDE_ALL ) {
255
314
_checkParentPath ();
256
- _filterContext = _filterContext .createChildObjectContext (f , true );
257
- delegate .writeStartObject (forValue );
315
+ _filterContext = _filterContext .createChildObjectContext (f , currValue , true );
316
+ delegate .writeStartObject (currValue , size );
258
317
} else { // filter out
259
- _filterContext = _filterContext .createChildObjectContext (f , false );
318
+ _filterContext = _filterContext .createChildObjectContext (f , currValue , false );
260
319
}
261
320
}
262
321
0 commit comments