Skip to content

Commit

Permalink
some more trimming of config access
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 16, 2018
1 parent 9dc7aaa commit cbca4d8
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 117 deletions.
53 changes: 20 additions & 33 deletions src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ protected Object readResolve() {
* needed to allow modules to add more custom type handling
* (mostly to support types of non-Java JVM languages)
*/
protected /*final*/ TypeFactory _typeFactory;
protected final TypeFactory _typeFactory;

/**
* Provider for values to inject in deserialized POJOs.
*/
protected InjectableValues _injectableValues;
protected final InjectableValues _injectableValues;

/**
* Thing used for registering sub-types, resolving them to
Expand Down Expand Up @@ -269,6 +269,7 @@ protected Object readResolve() {
/**********************************************************
*/

// !!! TODO 15-Mar-2018: Only mutable for Default Typing
/**
* Configuration object that defines basic global
* settings for the serialization process
Expand All @@ -290,14 +291,15 @@ protected Object readResolve() {
/**
* Serializer factory used for constructing serializers.
*/
protected SerializerFactory _serializerFactory;
protected final SerializerFactory _serializerFactory;

/*
/**********************************************************
/* Configuration settings, deserialization
/**********************************************************
*/

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

/*
/**********************************************************
Expand Down Expand Up @@ -339,7 +341,7 @@ protected Object readResolve() {
* no type information is needed for base type), or type-wrapped
* deserializers (if it is needed)
*/
final protected ConcurrentHashMap<JavaType, JsonDeserializer<Object>> _rootDeserializers
protected final ConcurrentHashMap<JavaType, JsonDeserializer<Object>> _rootDeserializers
= new ConcurrentHashMap<JavaType, JsonDeserializer<Object>>(64, 0.6f, 2);

/*
Expand All @@ -354,7 +356,7 @@ protected Object readResolve() {
*
* @since 3.0
*/
final protected MapperBuilderState _savedBuilderState;
protected final MapperBuilderState _savedBuilderState;

/*
/**********************************************************************
Expand Down Expand Up @@ -506,10 +508,22 @@ public Version version() {
/**********************************************************************
*/

/**
* Accessor for internal configuration object that contains settings for
* serialization operations (<code>writeValue(...)</code> methods)
*<br>
* NOTE: Not to be used by application code; needed by some tests
*/
public SerializationConfig serializationConfig() {
return _serializationConfig;
}

/**
* Accessor for internal configuration object that contains settings for
* deserialization operations (<code>readValue(...)</code> methods)
*<br>
* NOTE: Not to be used by application code; needed by some tests
*/
public DeserializationConfig deserializationConfig() {
return _deserializationConfig;
}
Expand Down Expand Up @@ -553,13 +567,6 @@ public InjectableValues getInjectableValues() {
return _injectableValues;
}

/**
* Method for accessing subtype resolver in use.
*/
public SubtypeResolver getSubtypeResolver() {
return _subtypeResolver;
}

/*
/**********************************************************************
/* Configuration: ser/deser factory, provider access
Expand All @@ -570,15 +577,6 @@ public SerializerProvider getSerializerProvider() {
return _serializerProvider;
}

/**
* Accessor for constructing and returning a {@link SerializerProvider}
* instance that may be used for accessing serializers. This is same as
* calling {@link #getSerializerProvider}, and calling <code>createInstance</code> on it.
*/
public SerializerProvider serializerProviderInstance() {
return _serializerProvider();
}

/*
/**********************************************************************
/* Configuration, access to type factory, type resolution
Expand All @@ -600,17 +598,6 @@ public TypeFactory getTypeFactory() {
public JavaType constructType(Type t) {
return _typeFactory.constructType(t);
}

/*
/**********************************************************************
/* Configuration: mix-in annotations
/**********************************************************************
*/

// For testing only:
public MixInHandler mixInHandler() {
return _mixIns;
}

/*
/**********************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,14 +728,6 @@ public InjectableValues getInjectableValues() {
return _injectableValues;
}

/**
* @deprecated Since 3.0 use {@link #parserFactory}
*/
@Deprecated
public TokenStreamFactory getFactory() {
return parserFactory();
}

/**
* @deprecated Since 3.0 use {@link #typeFactory}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,14 +793,6 @@ public ContextAttributes getAttributes() {
return _config.getAttributes();
}

/**
* @deprecated Since 3.0 use {@link #generatorFactory()}
*/
@Deprecated
public TokenStreamFactory getFactory() {
return generatorFactory();
}

/**
* @deprecated Since 3.0 use {@link #typeFactory}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,26 +245,6 @@ public TypeSerializer findTypeSerializer(SerializationConfig config,
BeanDescription bean = config.introspectClassAnnotations(baseType.getRawClass());
return config.getTypeResolverProvider().findTypeSerializer(config,
bean.getClassInfo(), baseType);

/*
AnnotationIntrospector ai = config.getAnnotationIntrospector();
JsonTypeInfo.Value typeInfo = ai.findPolymorphicTypeInfo(config, ac);
TypeResolverBuilder<?> b = ai.findTypeResolver(config, ac, baseType, typeInfo);
// Ok: if there is no explicit type info handler, we may want to
// use a default. If so, config object knows what to use.
Collection<NamedType> subtypes = null;
if (b == null) {
b = config.getDefaultTyper(baseType);
} else {
subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass(config, ac);
}
if (b == null) {
return null;
}
// 10-Jun-2015, tatu: Since not created for Bean Property, no need for post-processing
// wrt EXTERNAL_PROPERTY
return b.buildTypeSerializer(config, baseType, subtypes);
*/
}

/*
Expand Down
11 changes: 0 additions & 11 deletions src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,6 @@ public void testCustomDefaultPrettyPrinter() throws Exception
.writeValueAsString(input));
}

// for [databind#898]
public void testSerializerProviderAccess() throws Exception
{
// ensure we have "fresh" instance, just in case
ObjectMapper mapper = new ObjectMapper();
JsonSerializer<?> ser = mapper.serializerProviderInstance()
.findValueSerializer(Bean.class);
assertNotNull(ser);
assertEquals(Bean.class, ser.handledType());
}

public void testDataOutputViaMapper() throws Exception
{
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -329,17 +329,6 @@ public void setupModule(SetupContext context)
assertNotNull(mapper);
}

// [databind#626]
public void testMixIns626() throws Exception
{
// no real annotations, but nominally add ones from 'String' to 'Object', just for testing
ObjectMapper mapper = ObjectMapper.builder()
.addModule(new TestModule626(Object.class, String.class))
.build();
Class<?> found = mapper.mixInHandler().findMixInClassFor(Object.class);
assertEquals(String.class, found);
}

public void testAutoDiscovery() throws Exception
{
List<?> mods = MapperBuilder.findModules();
Expand Down

0 comments on commit cbca4d8

Please sign in to comment.