Module tools.jackson.dataformat.xml
Package tools.jackson.dataformat.xml.ser
Class XmlBeanSerializerBase
java.lang.Object
tools.jackson.databind.ValueSerializer<T>
tools.jackson.databind.ser.std.StdSerializer<Object>
tools.jackson.databind.ser.bean.BeanSerializerBase
tools.jackson.dataformat.xml.ser.XmlBeanSerializerBase
- All Implemented Interfaces:
tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
- Direct Known Subclasses:
UnwrappingXmlBeanSerializer,XmlBeanSerializer
public abstract class XmlBeanSerializerBase
extends tools.jackson.databind.ser.bean.BeanSerializerBase
Specific sub-class of
BeanSerializerBase needed to take care
of some xml-specific aspects, such as distinction between attributes
and elements.-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.ValueSerializer
tools.jackson.databind.ValueSerializer.None -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intNumber of attributes to write; these will have been ordered to be the first properties to write.protected final BitSetOptional set of indexes of properties that should be serialized as CDATA, instead of regular XML text segment.protected final intIndex of "text value" property we have, if any; can have at most one such property.protected final QName[]Array that contains namespace URIs associated with properties, if any; null if no namespace definitions have been assignedstatic final StringMarker used for storing associated internal data withBeanPropertyWriterinstances; to mark instances that are to be written out as attributes.Fields inherited from class tools.jackson.databind.ser.bean.BeanSerializerBase
_beanType, _filteredProps, _objectIdWriter, _propertyFilterId, _props, _serializationShape, _typeId, NAME_FOR_OBJECT_REF, NO_PROPSFields inherited from class tools.jackson.databind.ser.std.StdSerializer
_handledType -
Constructor Summary
ConstructorsModifierConstructorDescriptionXmlBeanSerializerBase(tools.jackson.databind.ser.bean.BeanSerializerBase src) protectedXmlBeanSerializerBase(XmlBeanSerializerBase src, Set<String> toIgnore, Set<String> toInclude) protectedXmlBeanSerializerBase(XmlBeanSerializerBase src, tools.jackson.databind.ser.BeanPropertyWriter[] properties, tools.jackson.databind.ser.BeanPropertyWriter[] filteredProperties) protectedXmlBeanSerializerBase(XmlBeanSerializerBase src, tools.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter) protectedXmlBeanSerializerBase(XmlBeanSerializerBase src, tools.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter, Object filterId) XmlBeanSerializerBase(XmlBeanSerializerBase src, tools.jackson.databind.util.NameTransformer transformer) -
Method Summary
Modifier and TypeMethodDescriptionprotected static boolean_isAttribute(tools.jackson.databind.ser.BeanPropertyWriter bpw) protected static boolean_isCData(tools.jackson.databind.ser.BeanPropertyWriter bpw) protected static int_orderAttributesFirst(tools.jackson.databind.ser.BeanPropertyWriter[] properties, tools.jackson.databind.ser.BeanPropertyWriter[] filteredProperties) Method for re-sorting lists of bean properties such that attributes are strictly written before elements.protected void_serializeObjectId(Object bean, tools.jackson.core.JsonGenerator gen, tools.jackson.databind.SerializationContext ctxt, tools.jackson.databind.jsontype.TypeSerializer typeSer, tools.jackson.databind.ser.WritableObjectId objectId) protected void_serializeProperties(Object bean, tools.jackson.core.JsonGenerator gen0, tools.jackson.databind.SerializationContext ctxt) 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_serializePropertiesFiltered(Object bean, tools.jackson.core.JsonGenerator gen0, tools.jackson.databind.SerializationContext ctxt, Object filterId) voidserializeWithType(Object bean, tools.jackson.core.JsonGenerator gen, tools.jackson.databind.SerializationContext ctxt, tools.jackson.databind.jsontype.TypeSerializer typeSer) Methods inherited from class tools.jackson.databind.ser.bean.BeanSerializerBase
_serializePropertiesMaybeView, _serializePropertiesNoView, _serializeWithObjectId, _serializeWithObjectId, _typeIdDef, acceptJsonFormatVisitor, asArraySerializer, canCreateArraySerializer, createContextual, findConvertingSerializer, getFilterId, hasViewProperties, properties, propertyCount, resolve, serialize, toString, unwrappingSerializer, usesObjectId, withByNameInclusion, withFilterId, withObjectIdWriter, withPropertiesMethods inherited from class tools.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, _wrapIOFailure, acceptJsonFormatVisitorForBinary, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrowMethods inherited from class tools.jackson.databind.ValueSerializer
getDelegatee, isEmpty, isUnwrappingSerializer, replaceDelegatee, withFormatOverrides, withIgnoredProperties
-
Field Details
-
KEY_XML_INFO
Marker used for storing associated internal data withBeanPropertyWriterinstances; 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 _attributeCountNumber of attributes to write; these will have been ordered to be the first properties to write. -
_textPropertyIndex
protected final int _textPropertyIndexIndex of "text value" property we have, if any; can have at most one such property. -
_xmlNames
Array that contains namespace URIs associated with properties, if any; null if no namespace definitions have been assigned -
_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 Details
-
XmlBeanSerializerBase
public XmlBeanSerializerBase(tools.jackson.databind.ser.bean.BeanSerializerBase src) -
XmlBeanSerializerBase
protected XmlBeanSerializerBase(XmlBeanSerializerBase src, tools.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter) -
XmlBeanSerializerBase
protected XmlBeanSerializerBase(XmlBeanSerializerBase src, tools.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter, Object filterId) -
XmlBeanSerializerBase
protected XmlBeanSerializerBase(XmlBeanSerializerBase src, Set<String> toIgnore, Set<String> toInclude) -
XmlBeanSerializerBase
public XmlBeanSerializerBase(XmlBeanSerializerBase src, tools.jackson.databind.util.NameTransformer transformer) -
XmlBeanSerializerBase
protected XmlBeanSerializerBase(XmlBeanSerializerBase src, tools.jackson.databind.ser.BeanPropertyWriter[] properties, tools.jackson.databind.ser.BeanPropertyWriter[] filteredProperties)
-
-
Method Details
-
_serializeProperties
protected void _serializeProperties(Object bean, tools.jackson.core.JsonGenerator gen0, tools.jackson.databind.SerializationContext ctxt) throws tools.jackson.core.JacksonException Main serialization method needs to be overridden to allow XML-specific extra handling, such as indication of whether to write attributes or elements.- Overrides:
_serializePropertiesin classtools.jackson.databind.ser.bean.BeanSerializerBase- Throws:
tools.jackson.core.JacksonException
-
_serializePropertiesFiltered
protected void _serializePropertiesFiltered(Object bean, tools.jackson.core.JsonGenerator gen0, tools.jackson.databind.SerializationContext ctxt, Object filterId) throws tools.jackson.core.JacksonException - Overrides:
_serializePropertiesFilteredin classtools.jackson.databind.ser.bean.BeanSerializerBase- Throws:
tools.jackson.core.JacksonException
-
serializeWithType
public void serializeWithType(Object bean, tools.jackson.core.JsonGenerator gen, tools.jackson.databind.SerializationContext ctxt, tools.jackson.databind.jsontype.TypeSerializer typeSer) throws tools.jackson.core.JacksonException - Overrides:
serializeWithTypein classtools.jackson.databind.ser.bean.BeanSerializerBase- Throws:
tools.jackson.core.JacksonException
-
_serializeObjectId
protected void _serializeObjectId(Object bean, tools.jackson.core.JsonGenerator gen, tools.jackson.databind.SerializationContext ctxt, tools.jackson.databind.jsontype.TypeSerializer typeSer, tools.jackson.databind.ser.WritableObjectId objectId) throws tools.jackson.core.JacksonException - Overrides:
_serializeObjectIdin classtools.jackson.databind.ser.bean.BeanSerializerBase- Throws:
tools.jackson.core.JacksonException
-
_isAttribute
protected static boolean _isAttribute(tools.jackson.databind.ser.BeanPropertyWriter bpw) -
_isCData
protected static boolean _isCData(tools.jackson.databind.ser.BeanPropertyWriter bpw) -
_orderAttributesFirst
protected static int _orderAttributesFirst(tools.jackson.databind.ser.BeanPropertyWriter[] properties, tools.jackson.databind.ser.BeanPropertyWriter[] filteredProperties) Method for re-sorting lists of bean properties such that attributes are strictly written before elements.
-