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

com.fitbur.fasterxml.jackson.databind.ser.std.StdContainerSerializers Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.fitbur.fasterxml.jackson.databind.ser.std;

import com.fitbur.fasterxml.jackson.databind.*;
import com.fitbur.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fitbur.fasterxml.jackson.databind.ser.ContainerSerializer;
import com.fitbur.fasterxml.jackson.databind.ser.impl.IndexedListSerializer;
import com.fitbur.fasterxml.jackson.databind.ser.impl.IteratorSerializer;
import com.fitbur.fasterxml.jackson.databind.ser.std.CollectionSerializer;

/**
 * Dummy container class to group standard container serializers: serializers
 * that can serialize things like {@link java.util.List}s,
 * {@link java.util.Map}s and such.
 */
public class StdContainerSerializers
{
    protected StdContainerSerializers() { }
    
    /**
     * @since 2.1
     */
    public static ContainerSerializer indexedListSerializer(JavaType elemType,
            boolean staticTyping, TypeSerializer vts, JsonSerializer valueSerializer)
    {
        return new IndexedListSerializer(elemType, staticTyping, vts, null, valueSerializer);
    }
    
    /**
     * @since 2.1
     */
    public static ContainerSerializer collectionSerializer(JavaType elemType,
            boolean staticTyping, TypeSerializer vts, JsonSerializer valueSerializer)
    {
        return new CollectionSerializer(elemType, staticTyping, vts, null, valueSerializer);
    }

    public static ContainerSerializer iteratorSerializer(JavaType elemType,
            boolean staticTyping, TypeSerializer vts)
    {
        return new IteratorSerializer(elemType, staticTyping, vts, null);
    }

    public static ContainerSerializer iterableSerializer(JavaType elemType,
            boolean staticTyping, TypeSerializer vts)
    {
        return new IterableSerializer(elemType, staticTyping, vts, null);
    }

    public static JsonSerializer enumSetSerializer(JavaType enumType)
    {
        return new EnumSetSerializer(enumType, null);
    }

    /*
    /**********************************************************
    /* Deprecated methods
    /**********************************************************
     */

    /**
     * @com.fitburprecated Since 2.1; use variant that does not take 'property' argument
     */
    @Deprecated
    public static ContainerSerializer indexedListSerializer(JavaType elemType,
            boolean staticTyping, TypeSerializer vts, BeanProperty property,
            JsonSerializer valueSerializer)
    {
        return indexedListSerializer(elemType, staticTyping, vts, valueSerializer);
    }

    /**
     * @com.fitburprecated Since 2.1; use variant that does not take 'property' argument
     */
    @Deprecated
    public static ContainerSerializer collectionSerializer(JavaType elemType,
            boolean staticTyping, TypeSerializer vts, BeanProperty property,
            JsonSerializer valueSerializer)
    {
        return collectionSerializer(elemType, staticTyping, vts, valueSerializer);
    }
}