public class XmlBeanSerializer
extends com.fasterxml.jackson.databind.ser.BeanSerializer
BeanSerializer
needed to take care
of some xml-specific aspects, such as distinction between attributes
and elements.Modifier and Type | Field and Description |
---|---|
protected int |
_attributeCount
Number of attributes to write; these will have been ordered to be the first
properties to write.
|
protected int |
_textPropertyIndex
Index of "text value" property we have, if any; can have at most
one such property.
|
protected QName[] |
_xmlNames
Array that contains namespace URIs associated with properties, if any;
null if no namespace definitions have been assigned
|
static String |
KEY_XML_INFO
Marker used for storing associated internal data with
BeanPropertyWriter
instances; to mark instances that are to be written out as attributes. |
Modifier | Constructor and Description |
---|---|
|
XmlBeanSerializer(com.fasterxml.jackson.databind.ser.std.BeanSerializerBase src) |
protected |
XmlBeanSerializer(XmlBeanSerializer src,
com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter) |
Modifier and Type | Method and Description |
---|---|
protected static boolean |
_isAttribute(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 jgen,
com.fasterxml.jackson.databind.SerializerProvider provider,
com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer,
com.fasterxml.jackson.databind.ser.impl.WritableObjectId objectId) |
protected void |
serializeFields(Object bean,
com.fasterxml.jackson.core.JsonGenerator jgen0,
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(Object bean,
com.fasterxml.jackson.core.JsonGenerator jgen0,
com.fasterxml.jackson.databind.SerializerProvider provider) |
void |
serializeWithType(Object bean,
com.fasterxml.jackson.core.JsonGenerator jgen,
com.fasterxml.jackson.databind.SerializerProvider provider,
com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer) |
com.fasterxml.jackson.databind.JsonSerializer<Object> |
unwrappingSerializer(com.fasterxml.jackson.databind.util.NameTransformer unwrapper) |
com.fasterxml.jackson.databind.ser.BeanSerializer |
withObjectIdWriter(com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter) |
asArraySerializer, createDummy, serialize, toString, withFilterId, withIgnorals
_serializeWithObjectId, _serializeWithObjectId, acceptJsonFormatVisitor, createContextual, findConvertingSerializer, getSchema, resolve, usesObjectId
createObjectNode, createSchemaNode, createSchemaNode, findConvertingContentSerializer, findPropertyFilter, getSchema, handledType, isDefaultSerializer, wrapAndThrow, wrapAndThrow
getDelegatee, isEmpty, isUnwrappingSerializer, replaceDelegatee
public static final String KEY_XML_INFO
BeanPropertyWriter
instances; to mark instances that are to be written out as attributes.
Created as separate non-interned String to ensure there are no collisions.protected final int _attributeCount
protected final int _textPropertyIndex
protected final QName[] _xmlNames
public XmlBeanSerializer(com.fasterxml.jackson.databind.ser.std.BeanSerializerBase src)
protected XmlBeanSerializer(XmlBeanSerializer src, com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter)
public com.fasterxml.jackson.databind.JsonSerializer<Object> unwrappingSerializer(com.fasterxml.jackson.databind.util.NameTransformer unwrapper)
unwrappingSerializer
in class com.fasterxml.jackson.databind.ser.BeanSerializer
public com.fasterxml.jackson.databind.ser.BeanSerializer withObjectIdWriter(com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter objectIdWriter)
withObjectIdWriter
in class com.fasterxml.jackson.databind.ser.BeanSerializer
protected void serializeFields(Object bean, com.fasterxml.jackson.core.JsonGenerator jgen0, com.fasterxml.jackson.databind.SerializerProvider provider) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
serializeFields
in class com.fasterxml.jackson.databind.ser.std.BeanSerializerBase
IOException
com.fasterxml.jackson.core.JsonGenerationException
protected void serializeFieldsFiltered(Object bean, com.fasterxml.jackson.core.JsonGenerator jgen0, com.fasterxml.jackson.databind.SerializerProvider provider) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
serializeFieldsFiltered
in class com.fasterxml.jackson.databind.ser.std.BeanSerializerBase
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void serializeWithType(Object bean, com.fasterxml.jackson.core.JsonGenerator jgen, com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
serializeWithType
in class com.fasterxml.jackson.databind.ser.std.BeanSerializerBase
IOException
com.fasterxml.jackson.core.JsonGenerationException
protected void _serializeObjectId(Object bean, com.fasterxml.jackson.core.JsonGenerator jgen, com.fasterxml.jackson.databind.SerializerProvider provider, com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer, com.fasterxml.jackson.databind.ser.impl.WritableObjectId objectId) throws IOException, com.fasterxml.jackson.core.JsonProcessingException, com.fasterxml.jackson.core.JsonGenerationException
_serializeObjectId
in class com.fasterxml.jackson.databind.ser.std.BeanSerializerBase
IOException
com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonGenerationException
protected static boolean _isAttribute(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)
Copyright © 2012–2014 FasterXML. All rights reserved.