Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.pdd.pop.ext.fasterxml.jackson.databind.module;
import java.util.*;
import com.pdd.pop.ext.fasterxml.jackson.databind.*;
import com.pdd.pop.ext.fasterxml.jackson.databind.deser.Deserializers;
import com.pdd.pop.ext.fasterxml.jackson.databind.jsontype.TypeDeserializer;
import com.pdd.pop.ext.fasterxml.jackson.databind.type.*;
/**
* Simple implementation {@link Deserializers} 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 {@link Map}s and {@link Collection}s
* or array types).
*
* Unlike {@link SimpleSerializers}, this class does not currently support generic mappings;
* all mappings must be to exact declared deserialization type.
*/
public class SimpleDeserializers
implements Deserializers, java.io.Serializable
{
private static final long serialVersionUID = 1L;
protected HashMap> _classMappings = null;
/**
* Flag to help find "generic" enum deserializer, if one has been registered.
*
* @since 2.3
*/
protected boolean _hasEnumDeserializer = false;
/*
/**********************************************************
/* Life-cycle, construction and configuring
/**********************************************************
*/
public SimpleDeserializers() { }
/**
* @since 2.1
*/
public SimpleDeserializers(Map,JsonDeserializer>> desers) {
addDeserializers(desers);
}
public void addDeserializer(Class forClass, JsonDeserializer extends T> deser)
{
ClassKey key = new ClassKey(forClass);
if (_classMappings == null) {
_classMappings = new HashMap>();
}
_classMappings.put(key, deser);
// [Issue#227]: generic Enum deserializer?
if (forClass == Enum.class) {
_hasEnumDeserializer = true;
}
}
/**
* @since 2.1
*/
@SuppressWarnings("unchecked")
public void addDeserializers(Map,JsonDeserializer>> desers)
{
for (Map.Entry,JsonDeserializer>> entry : desers.entrySet()) {
Class> cls = entry.getKey();
// what a mess... nominal generics safety...
JsonDeserializer