Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.module;
 
 import java.util.Map;
 
 
Simple implementation com.fasterxml.jackson.databind.deser.KeyDeserializers which allows registration of deserializers based on raw (type erased class). It can work well for basic bean and scalar type deserializers, but is not a good fit for handling generic types (like java.util.Maps and java.util.Collections or array types).

Unlike SimpleSerializers, this class does not currently support generic mappings; all mappings must be to exact declared deserialization type.

    implements KeyDeserializersjava.io.Serializable // since 2.1
    private static final long serialVersionUID = -6786398737835438187L;
    protected HashMap<ClassKey,KeyDeserializer_classMappings = null;
    /*
    /**********************************************************
    /* Life-cycle, construction and configuring
    /**********************************************************
     */
    
    public SimpleKeyDeserializers() { }
    public SimpleKeyDeserializers addDeserializer(Class<?> forClassKeyDeserializer deser)
    {
        if ( == null) {
             = new HashMap<ClassKey,KeyDeserializer>();
        }
        .put(new ClassKey(forClass), deser);
        return this;
    }
    /*
    /**********************************************************
    /* Serializers implementation
    /**********************************************************
     */
//  @Override
            DeserializationConfig configBeanDescription beanDesc)
    {
        if ( == null) {
            return null;
        }
        return .get(new ClassKey(type.getRawClass()));
    }
New to GrepCode? Check out our FAQ X