| 1 | |
package com.buckosoft.PicMan.service.support; |
| 2 | |
|
| 3 | |
import com.fasterxml.jackson.databind.BeanDescription; |
| 4 | |
import com.fasterxml.jackson.databind.DeserializationConfig; |
| 5 | |
import com.fasterxml.jackson.databind.JsonDeserializer; |
| 6 | |
import com.fasterxml.jackson.databind.JsonMappingException; |
| 7 | |
import com.fasterxml.jackson.databind.KeyDeserializer; |
| 8 | |
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; |
| 9 | |
import com.fasterxml.jackson.databind.module.SimpleDeserializers; |
| 10 | |
import com.fasterxml.jackson.databind.type.MapLikeType; |
| 11 | |
import com.fasterxml.jackson.databind.type.MapType; |
| 12 | |
|
| 13 | |
|
| 14 | 0 | public class MapDeserializersExt extends SimpleDeserializers { |
| 15 | |
|
| 16 | |
private static final long serialVersionUID = 1L; |
| 17 | |
|
| 18 | |
@Override |
| 19 | |
public JsonDeserializer<?> findMapDeserializer(MapType type, |
| 20 | |
DeserializationConfig config, BeanDescription beanDesc, |
| 21 | |
KeyDeserializer keyDeserializer, |
| 22 | |
TypeDeserializer elementTypeDeserializer, |
| 23 | |
JsonDeserializer<?> elementDeserializer) |
| 24 | |
throws JsonMappingException { |
| 25 | 0 | return createMapDeserializer(type, config, beanDesc, keyDeserializer, elementTypeDeserializer, elementDeserializer); |
| 26 | |
} |
| 27 | |
|
| 28 | |
@Override |
| 29 | |
public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type, |
| 30 | |
DeserializationConfig config, BeanDescription beanDesc, |
| 31 | |
KeyDeserializer keyDeserializer, |
| 32 | |
TypeDeserializer elementTypeDeserializer, |
| 33 | |
JsonDeserializer<?> elementDeserializer) |
| 34 | |
throws JsonMappingException { |
| 35 | 0 | return createMapDeserializer(type, config, beanDesc, keyDeserializer, elementTypeDeserializer, elementDeserializer); |
| 36 | |
} |
| 37 | |
|
| 38 | |
@SuppressWarnings("unchecked") |
| 39 | |
public JsonDeserializer<?> createMapDeserializer(MapLikeType type, |
| 40 | |
DeserializationConfig config, BeanDescription beanDesc, |
| 41 | |
KeyDeserializer keyDeserializer, |
| 42 | |
TypeDeserializer elementTypeDeserializer, |
| 43 | |
JsonDeserializer<?> elementDeserializer) { |
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | 0 | return new KeyValueMapDeserializer(type, null, null, (JsonDeserializer<Object>) elementDeserializer, elementTypeDeserializer); |
| 59 | |
} |
| 60 | |
} |