Example usage for com.fasterxml.jackson.databind DeserializationContext findKeyDeserializer

List of usage examples for com.fasterxml.jackson.databind DeserializationContext findKeyDeserializer

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind DeserializationContext findKeyDeserializer.

Prototype

public final KeyDeserializer findKeyDeserializer(JavaType paramJavaType, BeanProperty paramBeanProperty) 

Source Link

Usage

From source file:net.nullschool.grains.jackson.datatype.AbstractBasicConstMapDeserializer.java

@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property)
        throws JsonMappingException {

    KeyDeserializer kd = keyDeserializer != null ? keyDeserializer
            : ctxt.findKeyDeserializer(mapType.getKeyType(), property);
    JsonDeserializer<?> vd = valueDeserializer != null ? valueDeserializer
            : ctxt.findContextualValueDeserializer(mapType.getContentType(), property);
    TypeDeserializer vtd = valueTypeDeserializer != null ? valueTypeDeserializer.forProperty(property) : null;

    return withDeserializers(kd, vd, vtd);
}

From source file:javaslang.jackson.datatype.deserialize.MaplikeDeserializer.java

@SuppressWarnings("unchecked")
@Override/*from www  .j  av  a  2  s . co  m*/
public void resolve(DeserializationContext ctxt) throws JsonMappingException {
    mapLikeType = mapLike(javaType, ctxt);
    JavaType keyType = mapLikeType.getKeyType();
    if (keyType.getRawClass().isAssignableFrom(Comparable.class)) {
        keyComparator = (o1, o2) -> ((Comparable) o1).compareTo(o2);
    } else {
        keyComparator = (o1, o2) -> o1.toString().compareTo(o2.toString());
    }
    keyDeserializer = ctxt.findKeyDeserializer(keyType, null);
    valueDeserializer = ctxt.findRootValueDeserializer(mapLikeType.getContentType());
}