Sha256: a5433b80237a4b0992140f4b43b5b7291ccba08e843243ddf67df19e50ee16e6
Contents?: true
Size: 1.5 KB
Versions: 164
Compression:
Stored size: 1.5 KB
Contents
package sh.calaba.org.codehaus.jackson.map.module; import java.util.HashMap; import sh.calaba.org.codehaus.jackson.map.BeanDescription; import sh.calaba.org.codehaus.jackson.map.DeserializationConfig; import sh.calaba.org.codehaus.jackson.map.deser.ValueInstantiator; import sh.calaba.org.codehaus.jackson.map.deser.ValueInstantiators; import sh.calaba.org.codehaus.jackson.map.type.ClassKey; public class SimpleValueInstantiators extends ValueInstantiators.Base { /** * Mappings from raw (type-erased, i.e. non-generic) types * to matching {@link ValueInstantiator} instances. */ protected HashMap<ClassKey,ValueInstantiator> _classMappings; /* /********************************************************** /* Life-cycle, construction and configuring /********************************************************** */ public SimpleValueInstantiators() { _classMappings = new HashMap<ClassKey,ValueInstantiator>(); } 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; } }
Version data entries
164 entries across 164 versions & 2 rubygems