package com.fasterxml.jackson.dataformat.xml.ser;
import java.io.IOException;
import java.util.Set;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.ser.*;
import com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter;
import com.fasterxml.jackson.databind.ser.impl.UnwrappingBeanSerializer;
import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase;
import com.fasterxml.jackson.databind.util.NameTransformer;
public class UnwrappingXmlBeanSerializer extends XmlBeanSerializerBase
{
private static final long serialVersionUID = 1L;
protected final NameTransformer _nameTransformer;
public UnwrappingXmlBeanSerializer(XmlBeanSerializerBase src, NameTransformer transformer)
{
super(src, transformer);
_nameTransformer = transformer;
}
public UnwrappingXmlBeanSerializer(UnwrappingXmlBeanSerializer src, ObjectIdWriter objectIdWriter)
{
super(src, objectIdWriter);
_nameTransformer = src._nameTransformer;
}
public UnwrappingXmlBeanSerializer(UnwrappingXmlBeanSerializer src, ObjectIdWriter objectIdWriter, Object filterId)
{
super(src, objectIdWriter, filterId);
_nameTransformer = src._nameTransformer;
}
protected UnwrappingXmlBeanSerializer(UnwrappingXmlBeanSerializer src, Set<String> toIgnore)
{
super(src, toIgnore);
_nameTransformer = src._nameTransformer;
}
@Override
public JsonSerializer<Object> unwrappingSerializer(NameTransformer transformer)
{
return new UnwrappingXmlBeanSerializer(this, transformer);
}
@Override
public boolean isUnwrappingSerializer()
{
return true;
}
@Override
public BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter)
{
return new UnwrappingXmlBeanSerializer(this, objectIdWriter);
}
@Override
public BeanSerializerBase withFilterId(Object filterId)
{
return new UnwrappingXmlBeanSerializer(this, _objectIdWriter, filterId);
}
@Override
protected BeanSerializerBase withIgnorals(Set<String> toIgnore) {
return new UnwrappingXmlBeanSerializer(this, toIgnore);
}
@Override
protected BeanSerializerBase asArraySerializer() {
return this;
}
@Override
public final void serialize(Object bean, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
{
if (_objectIdWriter != null) {
_serializeWithObjectId(bean, jgen, provider, false);
return;
}
if (_propertyFilterId != null) {
serializeFieldsFiltered(bean, jgen, provider);
} else {
serializeFields(bean, jgen, provider);
}
}
@Override
public String toString()
{
return "UnwrappingXmlBeanSerializer for " + handledType().getName();
}
}