@@ -135,58 +135,87 @@ public void writeStartArray() throws IOException
135135 {
136136 // First things first: whole-sale skipping easy
137137 if (_itemFilter == null ) {
138- _filterContext = _filterContext .createChildArrayContext (null , false );
138+ _filterContext = _filterContext .createChildArrayContext (null , null , false );
139139 return ;
140140 }
141141 if (_itemFilter == TokenFilter .INCLUDE_ALL ) { // include the whole sub-tree?
142- _filterContext = _filterContext .createChildArrayContext (_itemFilter , true );
142+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , null , true );
143143 delegate .writeStartArray ();
144144 return ;
145145 }
146146 // Ok; regular checking state then
147147 _itemFilter = _filterContext .checkValue (_itemFilter );
148148 if (_itemFilter == null ) {
149- _filterContext = _filterContext .createChildArrayContext (null , false );
149+ _filterContext = _filterContext .createChildArrayContext (null , null , false );
150150 return ;
151151 }
152152 if (_itemFilter != TokenFilter .INCLUDE_ALL ) {
153153 _itemFilter = _itemFilter .filterStartArray ();
154154 }
155155 if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
156156 _checkParentPath ();
157- _filterContext = _filterContext .createChildArrayContext (_itemFilter , true );
157+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , null , true );
158158 delegate .writeStartArray ();
159159 } else {
160- _filterContext = _filterContext .createChildArrayContext (_itemFilter , false );
160+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , null , false );
161161 }
162162 }
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+
164193 @ Override
165- public void writeStartArray (int size ) throws IOException
194+ public void writeStartArray (Object currValue , int size ) throws IOException
166195 {
167196 if (_itemFilter == null ) {
168- _filterContext = _filterContext .createChildArrayContext (null , false );
197+ _filterContext = _filterContext .createChildArrayContext (null , currValue , false );
169198 return ;
170199 }
171200 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 );
174203 return ;
175204 }
176205 _itemFilter = _filterContext .checkValue (_itemFilter );
177206 if (_itemFilter == null ) {
178- _filterContext = _filterContext .createChildArrayContext (null , false );
207+ _filterContext = _filterContext .createChildArrayContext (null , currValue , false );
179208 return ;
180209 }
181210 if (_itemFilter != TokenFilter .INCLUDE_ALL ) {
182211 _itemFilter = _itemFilter .filterStartArray ();
183212 }
184213 if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
185214 _checkParentPath ();
186- _filterContext = _filterContext .createChildArrayContext (_itemFilter , true );
187- delegate .writeStartArray (size );
215+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , currValue , true );
216+ delegate .writeStartArray (currValue , size );
188217 } else {
189- _filterContext = _filterContext .createChildArrayContext (_itemFilter , false );
218+ _filterContext = _filterContext .createChildArrayContext (_itemFilter , currValue , false );
190219 }
191220 }
192221
@@ -204,11 +233,11 @@ public void writeEndArray() throws IOException
204233 public void writeStartObject () throws IOException
205234 {
206235 if (_itemFilter == null ) {
207- _filterContext = _filterContext .createChildObjectContext (_itemFilter , false );
236+ _filterContext = _filterContext .createChildObjectContext (_itemFilter , null , false );
208237 return ;
209238 }
210239 if (_itemFilter == TokenFilter .INCLUDE_ALL ) {
211- _filterContext = _filterContext .createChildObjectContext (_itemFilter , true );
240+ _filterContext = _filterContext .createChildObjectContext (_itemFilter , null , true );
212241 delegate .writeStartObject ();
213242 return ;
214243 }
@@ -223,23 +252,53 @@ public void writeStartObject() throws IOException
223252 }
224253 if (f == TokenFilter .INCLUDE_ALL ) {
225254 _checkParentPath ();
226- _filterContext = _filterContext .createChildObjectContext (f , true );
255+ _filterContext = _filterContext .createChildObjectContext (f , null , true );
227256 delegate .writeStartObject ();
228257 } else { // filter out
229- _filterContext = _filterContext .createChildObjectContext (f , false );
258+ _filterContext = _filterContext .createChildObjectContext (f , null , false );
230259 }
231260 }
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+
233292 @ Override
234- public void writeStartObject (Object forValue ) throws IOException
293+ public void writeStartObject (Object currValue , int size ) throws IOException
235294 {
236295 if (_itemFilter == null ) {
237- _filterContext = _filterContext .createChildObjectContext (_itemFilter , false );
296+ _filterContext = _filterContext .createChildObjectContext (_itemFilter , currValue , false );
238297 return ;
239298 }
240299 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 );
243302 return ;
244303 }
245304
@@ -253,10 +312,10 @@ public void writeStartObject(Object forValue) throws IOException
253312 }
254313 if (f == TokenFilter .INCLUDE_ALL ) {
255314 _checkParentPath ();
256- _filterContext = _filterContext .createChildObjectContext (f , true );
257- delegate .writeStartObject (forValue );
315+ _filterContext = _filterContext .createChildObjectContext (f , currValue , true );
316+ delegate .writeStartObject (currValue , size );
258317 } else { // filter out
259- _filterContext = _filterContext .createChildObjectContext (f , false );
318+ _filterContext = _filterContext .createChildObjectContext (f , currValue , false );
260319 }
261320 }
262321
0 commit comments