Skip to content

Commit 7d353ce

Browse files
committed
moar refactoring
1 parent 8d1c9c8 commit 7d353ce

File tree

8 files changed

+181
-202
lines changed

8 files changed

+181
-202
lines changed

src/main/java/com/fasterxml/jackson/databind/DeserializationConfig.java

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ public DeserializationConfig(MapperBuilder<?,?> b, int mapperFeatures,
9999
*/
100100

101101
private DeserializationConfig(DeserializationConfig src,
102-
int mapperFeatures, int deserFeatures, int parserFeatures,
102+
int deserFeatures, int parserFeatures,
103103
int formatParserFeatures)
104104
{
105-
super(src, mapperFeatures);
105+
super(src);
106106
_deserFeatures = deserFeatures;
107107
_parserFeatures = parserFeatures;
108108
_formatParserFeatures = formatParserFeatures;
@@ -176,12 +176,6 @@ protected final DeserializationConfig _withBase(BaseSettings newBase) {
176176
return (_base == newBase) ? this : new DeserializationConfig(this, newBase);
177177
}
178178

179-
@Override
180-
protected final DeserializationConfig _withMapperFeatures(int mapperFeatures) {
181-
return new DeserializationConfig(this, mapperFeatures, _deserFeatures, _parserFeatures,
182-
_formatParserFeatures);
183-
}
184-
185179
/*
186180
/**********************************************************************
187181
/* Life-cycle, specific factory methods from MapperConfig
@@ -224,7 +218,7 @@ public DeserializationConfig with(DeserializationFeature feature)
224218
{
225219
int newDeserFeatures = (_deserFeatures | feature.getMask());
226220
return (newDeserFeatures == _deserFeatures) ? this :
227-
new DeserializationConfig(this, _mapperFeatures, newDeserFeatures, _parserFeatures,
221+
new DeserializationConfig(this, newDeserFeatures, _parserFeatures,
228222
_formatParserFeatures);
229223
}
230224

@@ -240,7 +234,7 @@ public DeserializationConfig with(DeserializationFeature first,
240234
newDeserFeatures |= f.getMask();
241235
}
242236
return (newDeserFeatures == _deserFeatures) ? this :
243-
new DeserializationConfig(this, _mapperFeatures, newDeserFeatures, _parserFeatures,
237+
new DeserializationConfig(this, newDeserFeatures, _parserFeatures,
244238
_formatParserFeatures);
245239
}
246240

@@ -255,7 +249,7 @@ public DeserializationConfig withFeatures(DeserializationFeature... features)
255249
newDeserFeatures |= f.getMask();
256250
}
257251
return (newDeserFeatures == _deserFeatures) ? this :
258-
new DeserializationConfig(this, _mapperFeatures, newDeserFeatures,
252+
new DeserializationConfig(this, newDeserFeatures,
259253
_parserFeatures, _formatParserFeatures);
260254
}
261255

@@ -267,7 +261,7 @@ public DeserializationConfig without(DeserializationFeature feature)
267261
{
268262
int newDeserFeatures = _deserFeatures & ~feature.getMask();
269263
return (newDeserFeatures == _deserFeatures) ? this :
270-
new DeserializationConfig(this, _mapperFeatures, newDeserFeatures,
264+
new DeserializationConfig(this, newDeserFeatures,
271265
_parserFeatures, _formatParserFeatures);
272266
}
273267

@@ -283,7 +277,7 @@ public DeserializationConfig without(DeserializationFeature first,
283277
newDeserFeatures &= ~f.getMask();
284278
}
285279
return (newDeserFeatures == _deserFeatures) ? this :
286-
new DeserializationConfig(this, _mapperFeatures, newDeserFeatures, _parserFeatures,
280+
new DeserializationConfig(this, newDeserFeatures, _parserFeatures,
287281
_formatParserFeatures);
288282
}
289283

@@ -298,7 +292,7 @@ public DeserializationConfig withoutFeatures(DeserializationFeature... features)
298292
newDeserFeatures &= ~f.getMask();
299293
}
300294
return (newDeserFeatures == _deserFeatures) ? this :
301-
new DeserializationConfig(this, _mapperFeatures,
295+
new DeserializationConfig(this,
302296
newDeserFeatures, _parserFeatures, _formatParserFeatures);
303297
}
304298

@@ -316,7 +310,7 @@ public DeserializationConfig with(JsonParser.Feature feature)
316310
{
317311
int newSet = _parserFeatures | feature.getMask();
318312
return (_parserFeatures == newSet)? this :
319-
new DeserializationConfig(this, _mapperFeatures,
313+
new DeserializationConfig(this,
320314
_deserFeatures, newSet, _formatParserFeatures);
321315
}
322316

@@ -331,7 +325,7 @@ public DeserializationConfig withFeatures(JsonParser.Feature... features)
331325
newSet |= f.getMask();
332326
}
333327
return (_parserFeatures == newSet) ? this :
334-
new DeserializationConfig(this, _mapperFeatures, _deserFeatures, newSet,
328+
new DeserializationConfig(this, _deserFeatures, newSet,
335329
_formatParserFeatures);
336330
}
337331

@@ -343,7 +337,7 @@ public DeserializationConfig without(JsonParser.Feature feature)
343337
{
344338
int newSet = _parserFeatures & ~feature.getMask();
345339
return (_parserFeatures == newSet) ? this :
346-
new DeserializationConfig(this, _mapperFeatures, _deserFeatures, newSet,
340+
new DeserializationConfig(this, _deserFeatures, newSet,
347341
_formatParserFeatures);
348342
}
349343

@@ -358,8 +352,7 @@ public DeserializationConfig withoutFeatures(JsonParser.Feature... features)
358352
newSet &= ~f.getMask();
359353
}
360354
return (_parserFeatures == newSet)? this :
361-
new DeserializationConfig(this, _mapperFeatures,
362-
_deserFeatures, newSet, _formatParserFeatures);
355+
new DeserializationConfig(this, _deserFeatures, newSet, _formatParserFeatures);
363356
}
364357

365358
/*
@@ -376,7 +369,7 @@ public DeserializationConfig with(FormatFeature feature)
376369
{
377370
int newSet = _formatParserFeatures | feature.getMask();
378371
return (_formatParserFeatures == newSet) ? this
379-
: new DeserializationConfig(this, _mapperFeatures,
372+
: new DeserializationConfig(this,
380373
_deserFeatures, _parserFeatures, newSet);
381374
}
382375

@@ -391,7 +384,7 @@ public DeserializationConfig withFeatures(FormatFeature... features)
391384
newSet |= f.getMask();
392385
}
393386
return (_formatParserFeatures == newSet) ? this
394-
: new DeserializationConfig(this, _mapperFeatures,
387+
: new DeserializationConfig(this,
395388
_deserFeatures, _parserFeatures, newSet);
396389
}
397390

@@ -403,7 +396,7 @@ public DeserializationConfig without(FormatFeature feature)
403396
{
404397
int newSet = _formatParserFeatures & ~feature.getMask();
405398
return (_formatParserFeatures == newSet) ? this
406-
: new DeserializationConfig(this, _mapperFeatures,
399+
: new DeserializationConfig(this,
407400
_deserFeatures, _parserFeatures, newSet);
408401
}
409402

@@ -418,9 +411,9 @@ public DeserializationConfig withoutFeatures(FormatFeature... features)
418411
newSet &= ~f.getMask();
419412
}
420413
return (_formatParserFeatures == newSet) ? this
421-
: new DeserializationConfig(this, _mapperFeatures,
414+
: new DeserializationConfig(this,
422415
_deserFeatures, _parserFeatures, newSet);
423-
}
416+
}
424417

425418
/*
426419
/**********************************************************************

src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,14 @@ protected ObjectMapper(MapperBuilder<?,?> builder)
398398

399399
// General framework factories
400400
_streamFactory = builder.streamFactory();
401-
BaseSettings base = builder.baseSettings();
402401
// bit tricky as we do NOT want to expose simple accessors (to a mutable thing)
403402
{
404403
final AtomicReference<ConfigOverrides> ref = new AtomicReference<>();
405404
builder.withAllConfigOverrides(overrides -> ref.set(overrides));
406405
_configOverrides = ref.get();
407406
}
408407
// general type handling
409-
_typeFactory = base.getTypeFactory();
408+
_typeFactory = builder.typeFactory();
410409

411410
_subtypeResolver = builder.subtypeResolver();
412411

src/main/java/com/fasterxml/jackson/databind/SerializationConfig.java

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ public SerializationConfig(MapperBuilder<?,?> b,
110110
/**********************************************************************
111111
*/
112112

113-
private SerializationConfig(SerializationConfig src, int mapperFeatures,
113+
private SerializationConfig(SerializationConfig src,
114114
int serFeatures, int generatorFeatures, int formatWriteFeatures)
115115
{
116-
super(src, mapperFeatures);
116+
super(src);
117117
_serFeatures = serFeatures;
118118
_filterProvider = src._filterProvider;
119119
_defaultPrettyPrinter = src._defaultPrettyPrinter;
@@ -192,12 +192,6 @@ protected final SerializationConfig _withBase(BaseSettings newBase) {
192192
return (_base == newBase) ? this : new SerializationConfig(this, newBase);
193193
}
194194

195-
@Override
196-
protected final SerializationConfig _withMapperFeatures(int mapperFeatures) {
197-
return new SerializationConfig(this, mapperFeatures, _serFeatures,
198-
_generatorFeatures, _formatWriteFeatures);
199-
}
200-
201195
@Override
202196
public SerializationConfig withRootName(PropertyName rootName) {
203197
if (rootName == null) {
@@ -255,7 +249,7 @@ public SerializationConfig with(SerializationFeature feature)
255249
{
256250
int newSerFeatures = _serFeatures | feature.getMask();
257251
return (newSerFeatures == _serFeatures) ? this
258-
: new SerializationConfig(this, _mapperFeatures,
252+
: new SerializationConfig(this,
259253
newSerFeatures, _generatorFeatures, _formatWriteFeatures);
260254
}
261255

@@ -270,7 +264,7 @@ public SerializationConfig with(SerializationFeature first, SerializationFeature
270264
newSerFeatures |= f.getMask();
271265
}
272266
return (newSerFeatures == _serFeatures) ? this
273-
: new SerializationConfig(this, _mapperFeatures,
267+
: new SerializationConfig(this,
274268
newSerFeatures, _generatorFeatures, _formatWriteFeatures);
275269
}
276270

@@ -285,7 +279,7 @@ public SerializationConfig withFeatures(SerializationFeature... features)
285279
newSerFeatures |= f.getMask();
286280
}
287281
return (newSerFeatures == _serFeatures) ? this
288-
: new SerializationConfig(this, _mapperFeatures,
282+
: new SerializationConfig(this,
289283
newSerFeatures, _generatorFeatures, _formatWriteFeatures);
290284
}
291285

@@ -297,7 +291,7 @@ public SerializationConfig without(SerializationFeature feature)
297291
{
298292
int newSerFeatures = _serFeatures & ~feature.getMask();
299293
return (newSerFeatures == _serFeatures) ? this
300-
: new SerializationConfig(this, _mapperFeatures,
294+
: new SerializationConfig(this,
301295
newSerFeatures, _generatorFeatures, _formatWriteFeatures);
302296
}
303297

@@ -312,7 +306,7 @@ public SerializationConfig without(SerializationFeature first, SerializationFeat
312306
newSerFeatures &= ~f.getMask();
313307
}
314308
return (newSerFeatures == _serFeatures) ? this
315-
: new SerializationConfig(this, _mapperFeatures, newSerFeatures,
309+
: new SerializationConfig(this, newSerFeatures,
316310
_generatorFeatures, _formatWriteFeatures);
317311
}
318312

@@ -327,7 +321,7 @@ public SerializationConfig withoutFeatures(SerializationFeature... features)
327321
newSerFeatures &= ~f.getMask();
328322
}
329323
return (newSerFeatures == _serFeatures) ? this
330-
: new SerializationConfig(this, _mapperFeatures, newSerFeatures,
324+
: new SerializationConfig(this, newSerFeatures,
331325
_generatorFeatures, _formatWriteFeatures);
332326
}
333327

@@ -345,7 +339,7 @@ public SerializationConfig with(JsonGenerator.Feature feature)
345339
{
346340
int newSet = _generatorFeatures | feature.getMask();
347341
return (_generatorFeatures == newSet) ? this :
348-
new SerializationConfig(this, _mapperFeatures, _serFeatures, newSet,
342+
new SerializationConfig(this, _serFeatures, newSet,
349343
_formatWriteFeatures);
350344
}
351345

@@ -360,7 +354,7 @@ public SerializationConfig withFeatures(JsonGenerator.Feature... features)
360354
newSet |= f.getMask();
361355
}
362356
return (_generatorFeatures == newSet) ? this :
363-
new SerializationConfig(this, _mapperFeatures, _serFeatures, newSet,
357+
new SerializationConfig(this, _serFeatures, newSet,
364358
_formatWriteFeatures);
365359
}
366360

@@ -372,7 +366,7 @@ public SerializationConfig without(JsonGenerator.Feature feature)
372366
{
373367
int newSet = _generatorFeatures & ~feature.getMask();
374368
return (_generatorFeatures == newSet) ? this :
375-
new SerializationConfig(this, _mapperFeatures, _serFeatures, newSet,
369+
new SerializationConfig(this, _serFeatures, newSet,
376370
_formatWriteFeatures);
377371
}
378372

@@ -387,7 +381,7 @@ public SerializationConfig withoutFeatures(JsonGenerator.Feature... features)
387381
newSet &= ~f.getMask();
388382
}
389383
return (_generatorFeatures == newSet) ? this :
390-
new SerializationConfig(this, _mapperFeatures, _serFeatures, newSet,
384+
new SerializationConfig(this, _serFeatures, newSet,
391385
_formatWriteFeatures);
392386
}
393387

@@ -405,7 +399,7 @@ public SerializationConfig with(FormatFeature feature)
405399
{
406400
int newSet = _formatWriteFeatures | feature.getMask();
407401
return (_formatWriteFeatures == newSet) ? this :
408-
new SerializationConfig(this, _mapperFeatures,
402+
new SerializationConfig(this,
409403
_serFeatures, _generatorFeatures, newSet);
410404
}
411405

@@ -420,7 +414,7 @@ public SerializationConfig withFeatures(FormatFeature... features)
420414
newSet |= f.getMask();
421415
}
422416
return (_formatWriteFeatures == newSet) ? this :
423-
new SerializationConfig(this, _mapperFeatures,
417+
new SerializationConfig(this,
424418
_serFeatures, _generatorFeatures, newSet);
425419
}
426420

@@ -432,7 +426,7 @@ public SerializationConfig without(FormatFeature feature)
432426
{
433427
int newSet = _formatWriteFeatures & ~feature.getMask();
434428
return (_formatWriteFeatures == newSet) ? this :
435-
new SerializationConfig(this, _mapperFeatures,
429+
new SerializationConfig(this,
436430
_serFeatures, _generatorFeatures, newSet);
437431
}
438432

@@ -447,8 +441,7 @@ public SerializationConfig withoutFeatures(FormatFeature... features)
447441
newSet &= ~f.getMask();
448442
}
449443
return (_formatWriteFeatures == newSet) ? this :
450-
new SerializationConfig(this, _mapperFeatures,
451-
_serFeatures, _generatorFeatures, newSet);
444+
new SerializationConfig(this, _serFeatures, _generatorFeatures, newSet);
452445
}
453446

454447
/*

0 commit comments

Comments
 (0)