Class 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, Serializable
- Direct Known Subclasses:
UnwrappingXmlBeanSerializer, XmlBeanSerializer
public abstract class XmlBeanSerializerBase
extends com.fasterxml.jackson.databind.ser.std.BeanSerializerBase
Specific sub-class of
BeanSerializerBase needed to take care
of some xml-specific aspects, such as distinction between attributes
and elements.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
com.fasterxml.jackson.databind.JsonSerializer.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 com.fasterxml.jackson.databind.ser.std.BeanSerializerBase
_anyGetterWriter, _beanType, _filteredProps, _objectIdWriter, _propertyFilterId, _props, _serializationShape, _typeId, NAME_FOR_OBJECT_REF, NO_PROPSFields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_handledType -
Constructor Summary
ConstructorsModifierConstructorDescriptionXmlBeanSerializerBase(com.fasterxml.jackson.databind.ser.std.BeanSerializerBase src) protectedXmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.ser.BeanPropertyWriter[] properties, com.fasterxml.jackson.databind.ser.BeanPropertyWriter[] filteredProperties) protectedXmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter) protectedXmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter, Object filterId) XmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.util.NameTransformer transformer) protectedXmlBeanSerializerBase(XmlBeanSerializerBase src, Set<String> toIgnore, Set<String> toInclude) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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(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 voidserializeFields(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 voidserializeFieldsFiltered(Object bean, com.fasterxml.jackson.core.JsonGenerator gen0, com.fasterxml.jackson.databind.SerializerProvider provider) voidserializeWithType(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, withByNameInclusion, withFilterId, withIgnorals, withIgnorals, withObjectIdWriter, withPropertiesMethods 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, wrapAndThrowMethods inherited from class com.fasterxml.jackson.databind.JsonSerializer
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, replaceDelegatee, unwrappingSerializer, 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(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, Object filterId) -
XmlBeanSerializerBase
protected XmlBeanSerializerBase(XmlBeanSerializerBase src, Set<String> toIgnore, Set<String> toInclude) -
XmlBeanSerializerBase
public XmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.util.NameTransformer transformer) -
XmlBeanSerializerBase
protected XmlBeanSerializerBase(XmlBeanSerializerBase src, com.fasterxml.jackson.databind.ser.BeanPropertyWriter[] properties, com.fasterxml.jackson.databind.ser.BeanPropertyWriter[] filteredProperties)
-
-
Method Details
-
serializeFields
protected void serializeFields(Object bean, com.fasterxml.jackson.core.JsonGenerator gen0, com.fasterxml.jackson.databind.SerializerProvider provider) throws 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:
serializeFieldsin classcom.fasterxml.jackson.databind.ser.std.BeanSerializerBase- Throws:
IOException
-
serializeFieldsFiltered
protected void serializeFieldsFiltered(Object bean, com.fasterxml.jackson.core.JsonGenerator gen0, com.fasterxml.jackson.databind.SerializerProvider provider) throws IOException - Overrides:
serializeFieldsFilteredin classcom.fasterxml.jackson.databind.ser.std.BeanSerializerBase- Throws:
IOException
-
serializeWithType
public void serializeWithType(Object bean, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer) throws IOException - Overrides:
serializeWithTypein classcom.fasterxml.jackson.databind.ser.std.BeanSerializerBase- Throws:
IOException
-
_serializeObjectId
protected void _serializeObjectId(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 IOException - Overrides:
_serializeObjectIdin classcom.fasterxml.jackson.databind.ser.std.BeanSerializerBase- Throws:
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.
-