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

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

Introduction

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

Prototype

public final TypeFactory getTypeFactory() 

Source Link

Usage

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

private static MapLikeType mapLike(JavaType type, DeserializationContext ctxt) {
    JavaType keyType = type.containedTypeCount() > 0 ? type.containedType(0) : TypeFactory.unknownType();
    JavaType valueType = type.containedTypeCount() > 1 ? type.containedType(1) : TypeFactory.unknownType();
    return ctxt.getTypeFactory().constructMapLikeType(type.getRawClass(), keyType, valueType);
}

From source file:org.ebayopensource.common.util.ParametersDeserializer.java

/**
 * We need to implement this method to properly find things to delegate
 * to: it can not be done earlier since delegated deserializers almost
 * certainly require access to this instance (at least "List" and "Map" ones)
 *///w w  w .  j  a  va 2  s. com
@Override
public void resolve(DeserializationContext ctxt) throws JsonMappingException {
    JavaType obType = ctxt.constructType(Object.class);
    JavaType stringType = ctxt.constructType(String.class);
    TypeFactory tf = ctxt.getTypeFactory();
    _mapDeserializer = _findCustomDeser(ctxt, tf.constructMapType(Map.class, stringType, obType));
}

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

@Override
public void resolve(DeserializationContext ctxt) throws JsonMappingException {
    for (GrainProperty gp : factory.getBasisProperties().values()) {
        JacksonGrainProperty prop = new JacksonGrainProperty(gp, ctxt.getTypeFactory(), getValueClass());
        JsonDeserializer<?> deserializer = ctxt.findContextualValueDeserializer(prop.getType(), prop);

        readers.put(prop.getName(), new PropertyReader(deserializer));
    }//from   w  w  w .j  a v  a  2 s  .  c  o m

    extValueDeserializer = ctxt.findContextualValueDeserializer(ctxt.constructType(Object.class), null);
    extArrayDeserializer = ctxt.findContextualValueDeserializer(ctxt.constructType(ConstCollection.class),
            null);
    extObjectDeserializer = ctxt.findContextualValueDeserializer(ctxt.constructType(ConstMap.class), null);
}