@@ -68,7 +68,7 @@ public final class DeserializationConfig
68
68
/**
69
69
* Bitflag of {@link JsonParser.Feature}s to enable/disable
70
70
*/
71
- protected final int _parserFeatureMask ;
71
+ protected final int _parserFeaturesToChange ;
72
72
73
73
/*
74
74
/**********************************************************
@@ -87,9 +87,21 @@ public DeserializationConfig(BaseSettings base,
87
87
_nodeFactory = JsonNodeFactory .instance ;
88
88
_problemHandlers = null ;
89
89
_parserFeatures = 0 ;
90
- _parserFeatureMask = 0 ;
90
+ _parserFeaturesToChange = 0 ;
91
91
}
92
92
93
+ private DeserializationConfig (DeserializationConfig src ,
94
+ int mapperFeatures , int deserFeatures ,
95
+ int parserFeatures , int parserFeatureMask )
96
+ {
97
+ super (src , mapperFeatures );
98
+ _deserFeatures = deserFeatures ;
99
+ _nodeFactory = src ._nodeFactory ;
100
+ _problemHandlers = src ._problemHandlers ;
101
+ _parserFeatures = parserFeatures ;
102
+ _parserFeaturesToChange = parserFeatureMask ;
103
+ }
104
+
93
105
/**
94
106
* Copy constructor used to create a non-shared instance with given mix-in
95
107
* annotation definitions and subtype resolver.
@@ -101,19 +113,7 @@ private DeserializationConfig(DeserializationConfig src, SubtypeResolver str)
101
113
_nodeFactory = src ._nodeFactory ;
102
114
_problemHandlers = src ._problemHandlers ;
103
115
_parserFeatures = src ._parserFeatures ;
104
- _parserFeatureMask = src ._parserFeatureMask ;
105
- }
106
-
107
- private DeserializationConfig (DeserializationConfig src ,
108
- int mapperFeatures , int deserFeatures ,
109
- int parserFeatures , int parserFeatureMask )
110
- {
111
- super (src , mapperFeatures );
112
- _deserFeatures = deserFeatures ;
113
- _nodeFactory = src ._nodeFactory ;
114
- _problemHandlers = src ._problemHandlers ;
115
- _parserFeatures = parserFeatures ;
116
- _parserFeatureMask = parserFeatureMask ;
116
+ _parserFeaturesToChange = src ._parserFeaturesToChange ;
117
117
}
118
118
119
119
private DeserializationConfig (DeserializationConfig src , BaseSettings base )
@@ -123,7 +123,7 @@ private DeserializationConfig(DeserializationConfig src, BaseSettings base)
123
123
_nodeFactory = src ._nodeFactory ;
124
124
_problemHandlers = src ._problemHandlers ;
125
125
_parserFeatures = src ._parserFeatures ;
126
- _parserFeatureMask = src ._parserFeatureMask ;
126
+ _parserFeaturesToChange = src ._parserFeaturesToChange ;
127
127
}
128
128
129
129
private DeserializationConfig (DeserializationConfig src , JsonNodeFactory f )
@@ -133,7 +133,7 @@ private DeserializationConfig(DeserializationConfig src, JsonNodeFactory f)
133
133
_problemHandlers = src ._problemHandlers ;
134
134
_nodeFactory = f ;
135
135
_parserFeatures = src ._parserFeatures ;
136
- _parserFeatureMask = src ._parserFeatureMask ;
136
+ _parserFeaturesToChange = src ._parserFeaturesToChange ;
137
137
}
138
138
139
139
private DeserializationConfig (DeserializationConfig src ,
@@ -144,7 +144,7 @@ private DeserializationConfig(DeserializationConfig src,
144
144
_problemHandlers = problemHandlers ;
145
145
_nodeFactory = src ._nodeFactory ;
146
146
_parserFeatures = src ._parserFeatures ;
147
- _parserFeatureMask = src ._parserFeatureMask ;
147
+ _parserFeaturesToChange = src ._parserFeaturesToChange ;
148
148
}
149
149
150
150
private DeserializationConfig (DeserializationConfig src , String rootName )
@@ -154,7 +154,7 @@ private DeserializationConfig(DeserializationConfig src, String rootName)
154
154
_problemHandlers = src ._problemHandlers ;
155
155
_nodeFactory = src ._nodeFactory ;
156
156
_parserFeatures = src ._parserFeatures ;
157
- _parserFeatureMask = src ._parserFeatureMask ;
157
+ _parserFeaturesToChange = src ._parserFeaturesToChange ;
158
158
}
159
159
160
160
private DeserializationConfig (DeserializationConfig src , Class <?> view )
@@ -164,7 +164,7 @@ private DeserializationConfig(DeserializationConfig src, Class<?> view)
164
164
_problemHandlers = src ._problemHandlers ;
165
165
_nodeFactory = src ._nodeFactory ;
166
166
_parserFeatures = src ._parserFeatures ;
167
- _parserFeatureMask = src ._parserFeatureMask ;
167
+ _parserFeaturesToChange = src ._parserFeaturesToChange ;
168
168
}
169
169
170
170
/**
@@ -177,7 +177,7 @@ protected DeserializationConfig(DeserializationConfig src, Map<ClassKey,Class<?>
177
177
_problemHandlers = src ._problemHandlers ;
178
178
_nodeFactory = src ._nodeFactory ;
179
179
_parserFeatures = src ._parserFeatures ;
180
- _parserFeatureMask = src ._parserFeatureMask ;
180
+ _parserFeaturesToChange = src ._parserFeaturesToChange ;
181
181
}
182
182
183
183
/**
@@ -190,7 +190,7 @@ protected DeserializationConfig(DeserializationConfig src, ContextAttributes att
190
190
_problemHandlers = src ._problemHandlers ;
191
191
_nodeFactory = src ._nodeFactory ;
192
192
_parserFeatures = src ._parserFeatures ;
193
- _parserFeatureMask = src ._parserFeatureMask ;
193
+ _parserFeaturesToChange = src ._parserFeaturesToChange ;
194
194
}
195
195
196
196
// for unit tests only:
@@ -211,7 +211,7 @@ public DeserializationConfig with(MapperFeature... features)
211
211
}
212
212
return (newMapperFlags == _mapperFeatures ) ? this :
213
213
new DeserializationConfig (this , newMapperFlags , _deserFeatures ,
214
- _parserFeatures , _parserFeatureMask );
214
+ _parserFeatures , _parserFeaturesToChange );
215
215
216
216
}
217
217
@@ -224,7 +224,7 @@ public DeserializationConfig without(MapperFeature... features)
224
224
}
225
225
return (newMapperFlags == _mapperFeatures ) ? this :
226
226
new DeserializationConfig (this , newMapperFlags , _deserFeatures ,
227
- _parserFeatures , _parserFeatureMask );
227
+ _parserFeatures , _parserFeaturesToChange );
228
228
}
229
229
230
230
@ Override
@@ -238,7 +238,7 @@ public DeserializationConfig with(MapperFeature feature, boolean state)
238
238
}
239
239
return (newMapperFlags == _mapperFeatures ) ? this :
240
240
new DeserializationConfig (this , newMapperFlags , _deserFeatures ,
241
- _parserFeatures , _parserFeatureMask );
241
+ _parserFeatures , _parserFeaturesToChange );
242
242
}
243
243
244
244
@ Override
@@ -357,7 +357,7 @@ public DeserializationConfig with(DeserializationFeature feature)
357
357
int newDeserFeatures = (_deserFeatures | feature .getMask ());
358
358
return (newDeserFeatures == _deserFeatures ) ? this :
359
359
new DeserializationConfig (this , _mapperFeatures , newDeserFeatures ,
360
- _parserFeatures , _parserFeatureMask );
360
+ _parserFeatures , _parserFeaturesToChange );
361
361
}
362
362
363
363
/**
@@ -373,7 +373,7 @@ public DeserializationConfig with(DeserializationFeature first,
373
373
}
374
374
return (newDeserFeatures == _deserFeatures ) ? this :
375
375
new DeserializationConfig (this , _mapperFeatures , newDeserFeatures ,
376
- _parserFeatures , _parserFeatureMask );
376
+ _parserFeatures , _parserFeaturesToChange );
377
377
}
378
378
379
379
/**
@@ -388,7 +388,7 @@ public DeserializationConfig withFeatures(DeserializationFeature... features)
388
388
}
389
389
return (newDeserFeatures == _deserFeatures ) ? this :
390
390
new DeserializationConfig (this , _mapperFeatures , newDeserFeatures ,
391
- _parserFeatures , _parserFeatureMask );
391
+ _parserFeatures , _parserFeaturesToChange );
392
392
}
393
393
394
394
/**
@@ -400,7 +400,7 @@ public DeserializationConfig without(DeserializationFeature feature)
400
400
int newDeserFeatures = _deserFeatures & ~feature .getMask ();
401
401
return (newDeserFeatures == _deserFeatures ) ? this :
402
402
new DeserializationConfig (this , _mapperFeatures , newDeserFeatures ,
403
- _parserFeatures , _parserFeatureMask );
403
+ _parserFeatures , _parserFeaturesToChange );
404
404
}
405
405
406
406
/**
@@ -416,7 +416,7 @@ public DeserializationConfig without(DeserializationFeature first,
416
416
}
417
417
return (newDeserFeatures == _deserFeatures ) ? this :
418
418
new DeserializationConfig (this , _mapperFeatures , newDeserFeatures ,
419
- _parserFeatures , _parserFeatureMask );
419
+ _parserFeatures , _parserFeaturesToChange );
420
420
}
421
421
422
422
/**
@@ -431,7 +431,7 @@ public DeserializationConfig withoutFeatures(DeserializationFeature... features)
431
431
}
432
432
return (newDeserFeatures == _deserFeatures ) ? this :
433
433
new DeserializationConfig (this , _mapperFeatures , newDeserFeatures ,
434
- _parserFeatures , _parserFeatureMask );
434
+ _parserFeatures , _parserFeaturesToChange );
435
435
}
436
436
437
437
/*
@@ -443,61 +443,69 @@ public DeserializationConfig withoutFeatures(DeserializationFeature... features)
443
443
/**
444
444
* Fluent factory method that will construct and return a new configuration
445
445
* object instance with specified features enabled.
446
+ *
447
+ * @since 2.5
446
448
*/
447
449
public DeserializationConfig with (JsonParser .Feature feature )
448
450
{
449
451
int newSet = _parserFeatures | feature .getMask ();
450
- int newMask = _parserFeatureMask | feature .getMask ();
451
- return ((_parserFeatures == newSet ) && (_parserFeatureMask == newMask )) ? this :
452
+ int newMask = _parserFeaturesToChange | feature .getMask ();
453
+ return ((_parserFeatures == newSet ) && (_parserFeaturesToChange == newMask )) ? this :
452
454
new DeserializationConfig (this , _mapperFeatures , _deserFeatures ,
453
455
newSet , newMask );
454
456
}
455
457
456
458
/**
457
459
* Fluent factory method that will construct and return a new configuration
458
460
* object instance with specified features enabled.
461
+ *
462
+ * @since 2.5
459
463
*/
460
464
public DeserializationConfig withFeatures (JsonParser .Feature ... features )
461
465
{
462
466
int newSet = _parserFeatures ;
463
- int newMask = _parserFeatureMask ;
467
+ int newMask = _parserFeaturesToChange ;
464
468
for (JsonParser .Feature f : features ) {
465
469
int mask = f .getMask ();
466
470
newSet |= mask ;
467
471
newMask |= mask ;
468
472
}
469
- return ((_parserFeatures == newSet ) && (_parserFeatureMask == newMask )) ? this :
473
+ return ((_parserFeatures == newSet ) && (_parserFeaturesToChange == newMask )) ? this :
470
474
new DeserializationConfig (this , _mapperFeatures , _deserFeatures ,
471
475
newSet , newMask );
472
476
}
473
477
474
478
/**
475
479
* Fluent factory method that will construct and return a new configuration
476
480
* object instance with specified feature disabled.
481
+ *
482
+ * @since 2.5
477
483
*/
478
484
public DeserializationConfig without (JsonParser .Feature feature )
479
485
{
480
- int newSet = _parserFeatureMask & ~feature .getMask ();
486
+ int newSet = _parserFeaturesToChange & ~feature .getMask ();
481
487
int newMask = _parserFeatures | feature .getMask ();
482
- return ((_parserFeatures == newSet ) && (_parserFeatureMask == newMask )) ? this :
488
+ return ((_parserFeatures == newSet ) && (_parserFeaturesToChange == newMask )) ? this :
483
489
new DeserializationConfig (this , _mapperFeatures , _deserFeatures ,
484
490
newSet , newMask );
485
491
}
486
492
487
493
/**
488
494
* Fluent factory method that will construct and return a new configuration
489
495
* object instance with specified features disabled.
496
+ *
497
+ * @since 2.5
490
498
*/
491
499
public DeserializationConfig withoutFeatures (JsonParser .Feature ... features )
492
500
{
493
501
int newSet = _parserFeatures ;
494
- int newMask = _parserFeatureMask ;
502
+ int newMask = _parserFeaturesToChange ;
495
503
for (JsonParser .Feature f : features ) {
496
504
int mask = f .getMask ();
497
505
newSet &= ~mask ;
498
506
newMask |= mask ;
499
507
}
500
- return ((_parserFeatures == newSet ) && (_parserFeatureMask == newMask )) ? this :
508
+ return ((_parserFeatures == newSet ) && (_parserFeaturesToChange == newMask )) ? this :
501
509
new DeserializationConfig (this , _mapperFeatures , _deserFeatures ,
502
510
newSet , newMask );
503
511
}
@@ -552,16 +560,16 @@ public DeserializationConfig withNoProblemHandlers() {
552
560
*/
553
561
554
562
/**
555
- * Method called by {@link ObjectMapper} and {@link ObjectWriter }
556
- * to modify those {@link com.fasterxml.jackson.core.JsonGenerator .Feature} settings
563
+ * Method called by {@link ObjectMapper} and {@link ObjectReader }
564
+ * to modify those {@link com.fasterxml.jackson.core.JsonParser .Feature} settings
557
565
* that have been configured via this config instance.
558
566
*
559
567
* @since 2.5
560
568
*/
561
569
public void initialize (JsonParser p ) {
562
- if (_parserFeatureMask != 0 ) {
570
+ if (_parserFeaturesToChange != 0 ) {
563
571
int orig = p .getFeatureMask ();
564
- int newFlags = (orig & ~_parserFeatureMask ) | _parserFeatures ;
572
+ int newFlags = (orig & ~_parserFeaturesToChange ) | _parserFeatures ;
565
573
if (orig != newFlags ) {
566
574
p .setFeatureMask (newFlags );
567
575
}
0 commit comments