org.codehaus.jackson.map.ser.std.EnumSetSerializer Maven / Gradle / Ivy
Go to download
Data Mapper package is a high-performance data binding package
built on Jackson JSON processor
package org.codehaus.jackson.map.ser.std;
import java.io.IOException;
import java.util.EnumSet;
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.type.JavaType;
public class EnumSetSerializer
extends AsArraySerializerBase>>
{
public EnumSetSerializer(JavaType elemType, BeanProperty property)
{
super(EnumSet.class, elemType, true, null, property, null);
}
@Override
public ContainerSerializerBase> _withValueTypeSerializer(TypeSerializer vts) {
// no typing for enums (always "hard" type)
return this;
}
@Override
public void serializeContents(EnumSet extends Enum>> value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
{
JsonSerializer