*/
protected JsonSerializer<?> findCustomSerializer(Class<?> type, SerializationConfig config)
{
JsonSerializer<?> ser = null;
ClassKey key = new ClassKey(type);
// First: exact matches
if (_directClassMappings != null) {
ser = _directClassMappings.get(key);
if (ser != null) {
return ser;
}
}
// No match? Perhaps we can use the enum serializer?
if (type.isEnum()) {
if (_enumSerializerOverride != null) {
return _enumSerializerOverride;
}
}
// Still no match? How about more generic ones?
// Mappings for super-classes?
if (_transitiveClassMappings != null) {
for (Class<?> curr = type; (curr != null); curr = curr.getSuperclass()) {
key.reset(curr);
ser = _transitiveClassMappings.get(key);
if (ser != null) {
return ser;
}
}
}
// And if still no match, how about interfaces?
if (_interfaceMappings != null) {
// as per [JACKSON-327], better check actual interface first too...
key.reset(type);
ser = _interfaceMappings.get(key);
if (ser != null) {
return ser;
}
for (Class<?> curr = type; (curr != null); curr = curr.getSuperclass()) {