org.codehaus.jackson.map.ser.std.IterableSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ehcache Show documentation
Show all versions of ehcache Show documentation
Ehcache is an open source, standards-based cache used to boost performance,
offload the database and simplify scalability. Ehcache is robust, proven and full-featured and
this has made it the most widely-used Java-based cache.
package org.codehaus.jackson.map.ser.std;
import java.io.IOException;
import java.util.Iterator;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.map.BeanProperty;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
import org.codehaus.jackson.map.TypeSerializer;
import org.codehaus.jackson.map.annotate.JacksonStdImpl;
import org.codehaus.jackson.type.JavaType;
@JacksonStdImpl
public class IterableSerializer
extends AsArraySerializerBase>
{
public IterableSerializer(JavaType elemType, boolean staticTyping, TypeSerializer vts, BeanProperty property)
{
super(Iterable.class, elemType, staticTyping, vts, property, null);
}
@Override
public ContainerSerializerBase> _withValueTypeSerializer(TypeSerializer vts) {
return new IterableSerializer(_elementType, _staticTyping, vts, _property);
}
@Override
public void serializeContents(Iterable> value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
{
Iterator> it = value.iterator();
if (it.hasNext()) {
final TypeSerializer typeSer = _valueTypeSerializer;
JsonSerializer