com.fasterxml.jackson.databind.module.SimpleValueInstantiators Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redisson-all Show documentation
Show all versions of redisson-all Show documentation
Easy Redis Java client and Real-Time Data Platform. Valkey compatible. Sync/Async/RxJava3/Reactive API. Client side caching. Over 50 Redis based Java objects and services: JCache API, Apache Tomcat, Hibernate, Spring, Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Bloom filter, Scheduler, RPC
package com.fasterxml.jackson.databind.module;
import java.util.HashMap;
import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.deser.ValueInstantiator;
import com.fasterxml.jackson.databind.deser.ValueInstantiators;
import com.fasterxml.jackson.databind.type.ClassKey;
public class SimpleValueInstantiators
extends ValueInstantiators.Base
implements java.io.Serializable
{
private static final long serialVersionUID = -8929386427526115130L;
/**
* Mappings from raw (type-erased, i.e. non-generic) types
* to matching {@link ValueInstantiator} instances.
*/
protected HashMap _classMappings;
/*
/**********************************************************
/* Life-cycle, construction and configuring
/**********************************************************
*/
public SimpleValueInstantiators()
{
_classMappings = new HashMap();
}
public SimpleValueInstantiators addValueInstantiator(Class> forType,
ValueInstantiator inst)
{
_classMappings.put(new ClassKey(forType), inst);
return this;
}
@Override
public ValueInstantiator findValueInstantiator(DeserializationConfig config,
BeanDescription beanDesc, ValueInstantiator defaultInstantiator)
{
ValueInstantiator inst = _classMappings.get(new ClassKey(beanDesc.getBeanClass()));
return (inst == null) ? defaultInstantiator : inst;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy