Skip to content

Commit cbca4d8

Browse files
committed
some more trimming of config access
1 parent 9dc7aaa commit cbca4d8

File tree

7 files changed

+20
-117
lines changed

7 files changed

+20
-117
lines changed

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

+20-33
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,12 @@ protected Object readResolve() {
225225
* needed to allow modules to add more custom type handling
226226
* (mostly to support types of non-Java JVM languages)
227227
*/
228-
protected /*final*/ TypeFactory _typeFactory;
228+
protected final TypeFactory _typeFactory;
229229

230230
/**
231231
* Provider for values to inject in deserialized POJOs.
232232
*/
233-
protected InjectableValues _injectableValues;
233+
protected final InjectableValues _injectableValues;
234234

235235
/**
236236
* Thing used for registering sub-types, resolving them to
@@ -269,6 +269,7 @@ protected Object readResolve() {
269269
/**********************************************************
270270
*/
271271

272+
// !!! TODO 15-Mar-2018: Only mutable for Default Typing
272273
/**
273274
* Configuration object that defines basic global
274275
* settings for the serialization process
@@ -290,14 +291,15 @@ protected Object readResolve() {
290291
/**
291292
* Serializer factory used for constructing serializers.
292293
*/
293-
protected SerializerFactory _serializerFactory;
294+
protected final SerializerFactory _serializerFactory;
294295

295296
/*
296297
/**********************************************************
297298
/* Configuration settings, deserialization
298299
/**********************************************************
299300
*/
300301

302+
// !!! TODO 15-Mar-2018: Only mutable for Default Typing
301303
/**
302304
* Configuration object that defines basic global
303305
* settings for the serialization process
@@ -309,7 +311,7 @@ protected Object readResolve() {
309311
* sub-classes. Contains references to objects needed for
310312
* deserialization construction (cache, factory).
311313
*/
312-
protected DefaultDeserializationContext _deserializationContext;
314+
protected final DefaultDeserializationContext _deserializationContext;
313315

314316
/*
315317
/**********************************************************
@@ -339,7 +341,7 @@ protected Object readResolve() {
339341
* no type information is needed for base type), or type-wrapped
340342
* deserializers (if it is needed)
341343
*/
342-
final protected ConcurrentHashMap<JavaType, JsonDeserializer<Object>> _rootDeserializers
344+
protected final ConcurrentHashMap<JavaType, JsonDeserializer<Object>> _rootDeserializers
343345
= new ConcurrentHashMap<JavaType, JsonDeserializer<Object>>(64, 0.6f, 2);
344346

345347
/*
@@ -354,7 +356,7 @@ protected Object readResolve() {
354356
*
355357
* @since 3.0
356358
*/
357-
final protected MapperBuilderState _savedBuilderState;
359+
protected final MapperBuilderState _savedBuilderState;
358360

359361
/*
360362
/**********************************************************************
@@ -506,10 +508,22 @@ public Version version() {
506508
/**********************************************************************
507509
*/
508510

511+
/**
512+
* Accessor for internal configuration object that contains settings for
513+
* serialization operations (<code>writeValue(...)</code> methods)
514+
*<br>
515+
* NOTE: Not to be used by application code; needed by some tests
516+
*/
509517
public SerializationConfig serializationConfig() {
510518
return _serializationConfig;
511519
}
512520

521+
/**
522+
* Accessor for internal configuration object that contains settings for
523+
* deserialization operations (<code>readValue(...)</code> methods)
524+
*<br>
525+
* NOTE: Not to be used by application code; needed by some tests
526+
*/
513527
public DeserializationConfig deserializationConfig() {
514528
return _deserializationConfig;
515529
}
@@ -553,13 +567,6 @@ public InjectableValues getInjectableValues() {
553567
return _injectableValues;
554568
}
555569

556-
/**
557-
* Method for accessing subtype resolver in use.
558-
*/
559-
public SubtypeResolver getSubtypeResolver() {
560-
return _subtypeResolver;
561-
}
562-
563570
/*
564571
/**********************************************************************
565572
/* Configuration: ser/deser factory, provider access
@@ -570,15 +577,6 @@ public SerializerProvider getSerializerProvider() {
570577
return _serializerProvider;
571578
}
572579

573-
/**
574-
* Accessor for constructing and returning a {@link SerializerProvider}
575-
* instance that may be used for accessing serializers. This is same as
576-
* calling {@link #getSerializerProvider}, and calling <code>createInstance</code> on it.
577-
*/
578-
public SerializerProvider serializerProviderInstance() {
579-
return _serializerProvider();
580-
}
581-
582580
/*
583581
/**********************************************************************
584582
/* Configuration, access to type factory, type resolution
@@ -600,17 +598,6 @@ public TypeFactory getTypeFactory() {
600598
public JavaType constructType(Type t) {
601599
return _typeFactory.constructType(t);
602600
}
603-
604-
/*
605-
/**********************************************************************
606-
/* Configuration: mix-in annotations
607-
/**********************************************************************
608-
*/
609-
610-
// For testing only:
611-
public MixInHandler mixInHandler() {
612-
return _mixIns;
613-
}
614601

615602
/*
616603
/**********************************************************************

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

-8
Original file line numberDiff line numberDiff line change
@@ -728,14 +728,6 @@ public InjectableValues getInjectableValues() {
728728
return _injectableValues;
729729
}
730730

731-
/**
732-
* @deprecated Since 3.0 use {@link #parserFactory}
733-
*/
734-
@Deprecated
735-
public TokenStreamFactory getFactory() {
736-
return parserFactory();
737-
}
738-
739731
/**
740732
* @deprecated Since 3.0 use {@link #typeFactory}
741733
*/

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

-8
Original file line numberDiff line numberDiff line change
@@ -793,14 +793,6 @@ public ContextAttributes getAttributes() {
793793
return _config.getAttributes();
794794
}
795795

796-
/**
797-
* @deprecated Since 3.0 use {@link #generatorFactory()}
798-
*/
799-
@Deprecated
800-
public TokenStreamFactory getFactory() {
801-
return generatorFactory();
802-
}
803-
804796
/**
805797
* @deprecated Since 3.0 use {@link #typeFactory}
806798
*/

src/main/java/com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java

-20
Original file line numberDiff line numberDiff line change
@@ -245,26 +245,6 @@ public TypeSerializer findTypeSerializer(SerializationConfig config,
245245
BeanDescription bean = config.introspectClassAnnotations(baseType.getRawClass());
246246
return config.getTypeResolverProvider().findTypeSerializer(config,
247247
bean.getClassInfo(), baseType);
248-
249-
/*
250-
AnnotationIntrospector ai = config.getAnnotationIntrospector();
251-
JsonTypeInfo.Value typeInfo = ai.findPolymorphicTypeInfo(config, ac);
252-
TypeResolverBuilder<?> b = ai.findTypeResolver(config, ac, baseType, typeInfo);
253-
// Ok: if there is no explicit type info handler, we may want to
254-
// use a default. If so, config object knows what to use.
255-
Collection<NamedType> subtypes = null;
256-
if (b == null) {
257-
b = config.getDefaultTyper(baseType);
258-
} else {
259-
subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass(config, ac);
260-
}
261-
if (b == null) {
262-
return null;
263-
}
264-
// 10-Jun-2015, tatu: Since not created for Bean Property, no need for post-processing
265-
// wrt EXTERNAL_PROPERTY
266-
return b.buildTypeSerializer(config, baseType, subtypes);
267-
*/
268248
}
269249

270250
/*

src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java

-11
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,6 @@ public void testCustomDefaultPrettyPrinter() throws Exception
190190
.writeValueAsString(input));
191191
}
192192

193-
// for [databind#898]
194-
public void testSerializerProviderAccess() throws Exception
195-
{
196-
// ensure we have "fresh" instance, just in case
197-
ObjectMapper mapper = new ObjectMapper();
198-
JsonSerializer<?> ser = mapper.serializerProviderInstance()
199-
.findValueSerializer(Bean.class);
200-
assertNotNull(ser);
201-
assertEquals(Bean.class, ser.handledType());
202-
}
203-
204193
public void testDataOutputViaMapper() throws Exception
205194
{
206195
ByteArrayOutputStream bytes = new ByteArrayOutputStream();

src/test/java/com/fasterxml/jackson/databind/cfg/ConfigObjectsTest.java

-26
This file was deleted.

src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java

-11
Original file line numberDiff line numberDiff line change
@@ -329,17 +329,6 @@ public void setupModule(SetupContext context)
329329
assertNotNull(mapper);
330330
}
331331

332-
// [databind#626]
333-
public void testMixIns626() throws Exception
334-
{
335-
// no real annotations, but nominally add ones from 'String' to 'Object', just for testing
336-
ObjectMapper mapper = ObjectMapper.builder()
337-
.addModule(new TestModule626(Object.class, String.class))
338-
.build();
339-
Class<?> found = mapper.mixInHandler().findMixInClassFor(Object.class);
340-
assertEquals(String.class, found);
341-
}
342-
343332
public void testAutoDiscovery() throws Exception
344333
{
345334
List<?> mods = MapperBuilder.findModules();

0 commit comments

Comments
 (0)