com.fasterxml.jackson.xml.ser.XmlBeanPropertyWriter Maven / Gradle / Ivy
package com.fasterxml.jackson.xml.ser;
import javax.xml.namespace.QName;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
import org.codehaus.jackson.map.ser.BeanPropertyWriter;
import org.codehaus.jackson.map.ser.impl.PropertySerializerMap;
/**
* Property writer sub-class used for handling element wrapping needed for serializing
* collection (array, Collection; possibly Map) types.
*
* @since 1.7
*/
public class XmlBeanPropertyWriter
extends BeanPropertyWriter
{
/*
/**********************************************************
/* Config settings
/**********************************************************
*/
/**
* Element name used as wrapper for collection.
*/
protected final QName _wrapperName;
/**
* Element name used for items in the collection
*/
protected final QName _wrappedName;
/*
/**********************************************************
/* Life-cycle: construction, configuration
/**********************************************************
*/
public XmlBeanPropertyWriter(BeanPropertyWriter wrapped, QName wrapperName, QName wrappedName)
{
super(wrapped);
_wrapperName = wrapperName;
_wrappedName = wrappedName;
// super-class SHOULD copy this, but just in case it didn't (as was the case with 1.8.0 and 1.8.1):
if (_includeInViews == null) {
_includeInViews = wrapped.getViews();
}
}
public XmlBeanPropertyWriter(BeanPropertyWriter wrapped, QName wrapperName, QName wrappedName,
JsonSerializer