All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.jackson.databind.module.SimpleKeyDeserializers Maven / Gradle / Ivy

Go to download

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

There is a newer version: 3.40.2
Show newest version
package com.fasterxml.jackson.databind.module;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;


import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.KeyDeserializers;
import com.fasterxml.jackson.databind.type.ClassKey;

/**
 * Simple implementation {@link 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 {@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 SimpleKeyDeserializers implements KeyDeserializers, java.io.Serializable // since 2.1 { private static final long serialVersionUID = 1L; protected HashMap _classMappings = null; /* /********************************************************** /* Life-cycle, construction and configuring /********************************************************** */ public SimpleKeyDeserializers() { } public SimpleKeyDeserializers addDeserializer(Class forClass, KeyDeserializer deser) { if (_classMappings == null) { _classMappings = new HashMap(); } _classMappings.put(new ClassKey(forClass), deser); return this; } /* /********************************************************** /* Serializers implementation /********************************************************** */ @Override public KeyDeserializer findKeyDeserializer(JavaType type, DeserializationConfig config, BeanDescription beanDesc) { if (_classMappings == null) { return null; } return _classMappings.get(new ClassKey(type.getRawClass())); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy