com.fasterxml.jackson.xml.ser
Class XmlBeanSerializer
java.lang.Object
org.codehaus.jackson.map.JsonSerializer<T>
org.codehaus.jackson.map.ser.SerializerBase<Object>
org.codehaus.jackson.map.ser.BeanSerializer
com.fasterxml.jackson.xml.ser.XmlBeanSerializer
- All Implemented Interfaces:
- org.codehaus.jackson.map.ResolvableSerializer, org.codehaus.jackson.schema.SchemaAware
public class XmlBeanSerializer
- extends org.codehaus.jackson.map.ser.BeanSerializer
Specific sub-class of BeanSerializer
needed to take care
of some xml-specific aspects, such as distinction between attributes
and elements.
Nested classes/interfaces inherited from class org.codehaus.jackson.map.JsonSerializer |
org.codehaus.jackson.map.JsonSerializer.None |
Field Summary |
protected int |
_attributeCount
Number of attributes to write; these will have been ordered to be the first
properties to write. |
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. |
Fields inherited from class org.codehaus.jackson.map.ser.BeanSerializer |
_anyGetterWriter, _filteredProps, _propertyFilterId, _props, NO_PROPS |
Fields inherited from class org.codehaus.jackson.map.ser.SerializerBase |
_handledType |
Method Summary |
protected static boolean |
_isAttribute(org.codehaus.jackson.map.ser.BeanPropertyWriter bpw)
|
protected static int |
_orderAttributesFirst(org.codehaus.jackson.map.ser.BeanPropertyWriter[] properties,
org.codehaus.jackson.map.ser.BeanPropertyWriter[] filteredProperties)
Method for re-sorting lists of bean properties such that attributes are strictly
written before elements. |
protected void |
serializeFields(Object bean,
org.codehaus.jackson.JsonGenerator jgen0,
org.codehaus.jackson.map.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. |
void |
serializeWithType(Object bean,
org.codehaus.jackson.JsonGenerator jgen,
org.codehaus.jackson.map.SerializerProvider provider,
org.codehaus.jackson.map.TypeSerializer typeSer)
|
org.codehaus.jackson.map.ser.BeanSerializer |
withFiltered(org.codehaus.jackson.map.ser.BeanPropertyWriter[] filtered)
|
Methods inherited from class org.codehaus.jackson.map.ser.BeanSerializer |
createDummy, findFilter, getSchema, resolve, serialize, serializeFieldsFiltered, toString |
Methods inherited from class org.codehaus.jackson.map.ser.SerializerBase |
createObjectNode, createSchemaNode, createSchemaNode, handledType, isDefaultSerializer, wrapAndThrow, wrapAndThrow, wrapAndThrow, wrapAndThrow |
KEY_XML_INFO
public static final 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.
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.
_xmlNames
protected final QName[] _xmlNames
- Array that contains namespace URIs associated with properties, if any;
null if no namespace definitions have been assigned
XmlBeanSerializer
public XmlBeanSerializer(org.codehaus.jackson.map.ser.BeanSerializer src)
XmlBeanSerializer
protected XmlBeanSerializer(XmlBeanSerializer src,
org.codehaus.jackson.map.ser.BeanPropertyWriter[] filtered)
withFiltered
public org.codehaus.jackson.map.ser.BeanSerializer withFiltered(org.codehaus.jackson.map.ser.BeanPropertyWriter[] filtered)
- Overrides:
withFiltered
in class org.codehaus.jackson.map.ser.BeanSerializer
serializeFields
protected void serializeFields(Object bean,
org.codehaus.jackson.JsonGenerator jgen0,
org.codehaus.jackson.map.SerializerProvider provider)
throws IOException,
org.codehaus.jackson.JsonGenerationException
- 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 class org.codehaus.jackson.map.ser.BeanSerializer
- Throws:
IOException
org.codehaus.jackson.JsonGenerationException
serializeWithType
public void serializeWithType(Object bean,
org.codehaus.jackson.JsonGenerator jgen,
org.codehaus.jackson.map.SerializerProvider provider,
org.codehaus.jackson.map.TypeSerializer typeSer)
throws IOException,
org.codehaus.jackson.JsonGenerationException
- Overrides:
serializeWithType
in class org.codehaus.jackson.map.ser.BeanSerializer
- Throws:
IOException
org.codehaus.jackson.JsonGenerationException
_isAttribute
protected static boolean _isAttribute(org.codehaus.jackson.map.ser.BeanPropertyWriter bpw)
_orderAttributesFirst
protected static int _orderAttributesFirst(org.codehaus.jackson.map.ser.BeanPropertyWriter[] properties,
org.codehaus.jackson.map.ser.BeanPropertyWriter[] filteredProperties)
- Method for re-sorting lists of bean properties such that attributes are strictly
written before elements.
Copyright © 2011 fasterxml.com. All Rights Reserved.