Class XmlBeanSerializerBase
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonSerializer<T>
-
- com.fasterxml.jackson.databind.ser.std.StdSerializer<java.lang.Object>
-
- com.fasterxml.jackson.databind.ser.std.BeanSerializerBase
-
- com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializerBase
-
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
,com.fasterxml.jackson.databind.jsonschema.SchemaAware
,com.fasterxml.jackson.databind.ser.ContextualSerializer
,com.fasterxml.jackson.databind.ser.ResolvableSerializer
,java.io.Serializable
- Direct Known Subclasses:
UnwrappingXmlBeanSerializer
,XmlBeanSerializer
public abstract class XmlBeanSerializerBase extends com.fasterxml.jackson.databind.ser.std.BeanSerializerBase
Specific sub-class ofBeanSerializerBase
needed to take care of some xml-specific aspects, such as distinction between attributes and elements.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
_attributeCount
Number of attributes to write; these will have been ordered to be the first properties to write.protected java.util.BitSet
_cdata
Optional set of indexes of properties that should be serialized as CDATA, instead of regular XML text segment.protected int
_textPropertyIndex
Index of "text value" property we have, if any; can have at most one such property.protected javax.xml.namespace.QName[]
_xmlNames
Array that contains namespace URIs associated with properties, if any; null if no namespace definitions have been assignedstatic java.lang.String
KEY_XML_INFO
Marker used for storing associated internal data withBeanPropertyWriter
instances; to mark instances that are to be written out as attributes.
-
Constructor Summary
Constructors Modifier Constructor Description XmlBeanSerializerBase(com.fasterxml.jackson.databind.ser.std.BeanSerializerBase src)
protected
XmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter)
protected
XmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter, java.lang.Object filterId)
XmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.util.NameTransformer transformer)
protected
XmlBeanSerializerBase(XmlBeanSerializerBase src, java.util.Set<java.lang.String> toIgnore)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static boolean
_isAttribute(com.fasterxml.jackson.databind.ser.BeanPropertyWriter bpw)
protected static boolean
_isCData(com.fasterxml.jackson.databind.ser.BeanPropertyWriter bpw)
protected static int
_orderAttributesFirst(com.fasterxml.jackson.databind.ser.BeanPropertyWriter[] properties, com.fasterxml.jackson.databind.ser.BeanPropertyWriter[] filteredProperties)
Method for re-sorting lists of bean properties such that attributes are strictly written before elements.protected void
_serializeObjectId(java.lang.Object bean, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer, com.fasterxml.jackson.databind.ser.impl.WritableObjectId objectId)
protected void
serializeFields(java.lang.Object bean, com.fasterxml.jackson.core.JsonGenerator gen0, com.fasterxml.jackson.databind.SerializerProvider provider)
Main serialization method needs to be overridden to allow XML-specific extra handling, such as indication of whether to write attributes or elements.protected void
serializeFieldsFiltered(java.lang.Object bean, com.fasterxml.jackson.core.JsonGenerator gen0, com.fasterxml.jackson.databind.SerializerProvider provider)
void
serializeWithType(java.lang.Object bean, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer)
-
Methods inherited from class com.fasterxml.jackson.databind.ser.std.BeanSerializerBase
_customTypeId, _serializeWithObjectId, _serializeWithObjectId, _typeIdDef, acceptJsonFormatVisitor, asArraySerializer, createContextual, findConvertingSerializer, getSchema, properties, resolve, serialize, usesObjectId, withFilterId, withIgnorals, withIgnorals, withObjectIdWriter
-
Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow
-
Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, replaceDelegatee, unwrappingSerializer
-
-
-
-
Field Detail
-
KEY_XML_INFO
public static final java.lang.String KEY_XML_INFO
Marker used for storing associated internal data withBeanPropertyWriter
instances; to mark instances that are to be written out as attributes. Created as separate non-interned String to ensure there are no collisions.
-
_attributeCount
protected final int _attributeCount
Number of attributes to write; these will have been ordered to be the first properties to write.
-
_textPropertyIndex
protected final int _textPropertyIndex
Index of "text value" property we have, if any; can have at most one such property.
-
_xmlNames
protected final javax.xml.namespace.QName[] _xmlNames
Array that contains namespace URIs associated with properties, if any; null if no namespace definitions have been assigned
-
_cdata
protected final java.util.BitSet _cdata
Optional set of indexes of properties that should be serialized as CDATA, instead of regular XML text segment. Left as null in cases where none of element values are to be written in such a way.
-
-
Constructor Detail
-
XmlBeanSerializerBase
public XmlBeanSerializerBase(com.fasterxml.jackson.databind.ser.std.BeanSerializerBase src)
-
XmlBeanSerializerBase
protected XmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter)
-
XmlBeanSerializerBase
protected XmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter, java.lang.Object filterId)
-
XmlBeanSerializerBase
protected XmlBeanSerializerBase(XmlBeanSerializerBase src, java.util.Set<java.lang.String> toIgnore)
-
XmlBeanSerializerBase
public XmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.util.NameTransformer transformer)
-
-
Method Detail
-
serializeFields
protected void serializeFields(java.lang.Object bean, com.fasterxml.jackson.core.JsonGenerator gen0, com.fasterxml.jackson.databind.SerializerProvider provider) throws java.io.IOException
Main serialization method needs to be overridden to allow XML-specific extra handling, such as indication of whether to write attributes or elements.- Overrides:
serializeFields
in classcom.fasterxml.jackson.databind.ser.std.BeanSerializerBase
- Throws:
java.io.IOException
-
serializeFieldsFiltered
protected void serializeFieldsFiltered(java.lang.Object bean, com.fasterxml.jackson.core.JsonGenerator gen0, com.fasterxml.jackson.databind.SerializerProvider provider) throws java.io.IOException
- Overrides:
serializeFieldsFiltered
in classcom.fasterxml.jackson.databind.ser.std.BeanSerializerBase
- Throws:
java.io.IOException
-
serializeWithType
public void serializeWithType(java.lang.Object bean, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer) throws java.io.IOException
- Overrides:
serializeWithType
in classcom.fasterxml.jackson.databind.ser.std.BeanSerializerBase
- Throws:
java.io.IOException
-
_serializeObjectId
protected void _serializeObjectId(java.lang.Object bean, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer, com.fasterxml.jackson.databind.ser.impl.WritableObjectId objectId) throws java.io.IOException
- Overrides:
_serializeObjectId
in classcom.fasterxml.jackson.databind.ser.std.BeanSerializerBase
- Throws:
java.io.IOException
-
_isAttribute
protected static boolean _isAttribute(com.fasterxml.jackson.databind.ser.BeanPropertyWriter bpw)
-
_isCData
protected static boolean _isCData(com.fasterxml.jackson.databind.ser.BeanPropertyWriter bpw)
-
_orderAttributesFirst
protected static int _orderAttributesFirst(com.fasterxml.jackson.databind.ser.BeanPropertyWriter[] properties, com.fasterxml.jackson.databind.ser.BeanPropertyWriter[] filteredProperties)
Method for re-sorting lists of bean properties such that attributes are strictly written before elements.
-
-