Package com.facebook.presto.jdbc.internal.jackson.datatype.guava

Source Code of com.facebook.presto.jdbc.internal.jackson.datatype.guava.GuavaSerializers

package com.facebook.presto.jdbc.internal.jackson.datatype.guava;


import com.facebook.presto.jdbc.internal.jackson.databind.*;
import com.facebook.presto.jdbc.internal.jackson.databind.jsontype.TypeSerializer;
import com.facebook.presto.jdbc.internal.jackson.databind.ser.Serializers;
import com.facebook.presto.jdbc.internal.jackson.databind.type.MapLikeType;

import com.facebook.presto.jdbc.internal.jackson.datatype.guava.ser.GuavaOptionalSerializer;
import com.facebook.presto.jdbc.internal.jackson.datatype.guava.ser.MultimapSerializer;

import com.facebook.presto.jdbc.internal.guava.base.Optional;
import com.facebook.presto.jdbc.internal.guava.collect.Multimap;

public class GuavaSerializers extends Serializers.Base
{
    @Override
    public JsonSerializer<?> findSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) {
        Class<?> raw = type.getRawClass();
        if(Optional.class.isAssignableFrom(raw)){
            return new GuavaOptionalSerializer(type);
        }
        return super.findSerializer(config, type, beanDesc);
    }
    @Override
    public JsonSerializer<?> findMapLikeSerializer(SerializationConfig config,
            MapLikeType type, BeanDescription beanDesc, JsonSerializer<Object> keySerializer,
            TypeSerializer elementTypeSerializer, JsonSerializer<Object> elementValueSerializer)
    {
        if (Multimap.class.isAssignableFrom(type.getRawClass())) {
            return new MultimapSerializer(config, type, beanDesc, keySerializer,
                    elementTypeSerializer, elementValueSerializer);
        }
        return null;
    }
}
TOP

Related Classes of com.facebook.presto.jdbc.internal.jackson.datatype.guava.GuavaSerializers

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.