Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.ser.std;
 
 
 
Intermediate base class for serializers used for various Java arrays.

Parameters:
<T> Type of arrays serializer handles
public abstract class ArraySerializerBase<T>
    extends ContainerSerializer<T>
    protected final BeanProperty _property;
    protected ArraySerializerBase(Class<T> cls)
    {
        super(cls);
         = null;
    }
    protected ArraySerializerBase(Class<T> clsBeanProperty property)
    {
        super(cls);
         = property;
    }
    protected ArraySerializerBase(ArraySerializerBase<?> src)
    {
        super(src._handledTypefalse);
         = src._property;
    }
    
    protected ArraySerializerBase(ArraySerializerBase<?> srcBeanProperty property)
    {
        super(src._handledTypefalse);
         = property;
    }
    
    @Override
    public final void serialize(T valueJsonGenerator jgenSerializerProvider provider)
        throws IOExceptionJsonGenerationException
    {
        // [JACKSON-805]
                && hasSingleElement(value)) {
            serializeContents(valuejgenprovider);
            return;
        }
        jgen.writeStartArray();
        serializeContents(valuejgenprovider);
        jgen.writeEndArray();
    }
    
    @Override
    public final void serializeWithType(T valueJsonGenerator jgenSerializerProvider provider,
            TypeSerializer typeSer)
        throws IOExceptionJsonGenerationException
    {
        // note: let's NOT consider [JACKSON-805] here; gets too complicated, and probably just won't work
        typeSer.writeTypePrefixForArray(valuejgen);
        serializeContents(valuejgenprovider);
        typeSer.writeTypeSuffixForArray(valuejgen);
    }
    protected abstract void serializeContents(T valueJsonGenerator jgenSerializerProvider provider)
        throws IOExceptionJsonGenerationException;
New to GrepCode? Check out our FAQ X