com.fasterxml.jackson.dataformat.xml.ser
Class XmlSerializerProvider

java.lang.Object
  extended by com.fasterxml.jackson.databind.SerializerProvider
      extended by com.fasterxml.jackson.databind.ser.DefaultSerializerProvider
          extended by com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider
All Implemented Interfaces:
Serializable

public class XmlSerializerProvider
extends com.fasterxml.jackson.databind.ser.DefaultSerializerProvider

We need to override some parts of SerializerProvider implementation to handle oddities of XML output, like "extra" root element.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.ser.DefaultSerializerProvider
com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.Impl
 
Field Summary
protected  XmlRootNameLookup _rootNameLookup
           
protected static QName ROOT_NAME_FOR_NULL
          If all we get to serialize is a null, there's no way to figure out expected root name; so let's just default to something like "<null>"...
 
Fields inherited from class com.fasterxml.jackson.databind.ser.DefaultSerializerProvider
_objectIdGenerators, _seenObjectIds
 
Fields inherited from class com.fasterxml.jackson.databind.SerializerProvider
_config, _dateFormat, _keySerializer, _knownSerializers, _nullKeySerializer, _nullValueSerializer, _rootNames, _serializationView, _serializerCache, _serializerFactory, _unknownTypeSerializer, CACHE_UNKNOWN_MAPPINGS, DEFAULT_NULL_KEY_SERIALIZER, DEFAULT_UNKNOWN_SERIALIZER, TYPE_OBJECT
 
Constructor Summary
XmlSerializerProvider(XmlRootNameLookup rootNames)
           
XmlSerializerProvider(XmlSerializerProvider src, com.fasterxml.jackson.databind.SerializationConfig config, com.fasterxml.jackson.databind.ser.SerializerFactory f)
           
 
Method Summary
protected  void _initWithRootName(com.fasterxml.jackson.core.JsonGenerator jgen, QName rootName)
           
 com.fasterxml.jackson.databind.ser.DefaultSerializerProvider createInstance(com.fasterxml.jackson.databind.SerializationConfig config, com.fasterxml.jackson.databind.ser.SerializerFactory jsf)
           
 void serializeValue(com.fasterxml.jackson.core.JsonGenerator jgen, Object value)
           
 void serializeValue(com.fasterxml.jackson.core.JsonGenerator jgen, Object value, com.fasterxml.jackson.databind.JavaType rootType)
           
 void serializeValue(com.fasterxml.jackson.core.JsonGenerator jgen, Object value, com.fasterxml.jackson.databind.JavaType rootType, com.fasterxml.jackson.databind.JsonSerializer<Object> ser)
           
 
Methods inherited from class com.fasterxml.jackson.databind.ser.DefaultSerializerProvider
acceptJsonFormatVisitor, cachedSerializersCount, findObjectId, flushCachedSerializers, generateJsonSchema, hasSerializerFor, objectIdGeneratorInstance, serializerInstance
 
Methods inherited from class com.fasterxml.jackson.databind.SerializerProvider
_createAndCacheUntypedSerializer, _createAndCacheUntypedSerializer, _createUntypedSerializer, _dateFormat, _findExplicitUntypedSerializer, _handleContextual, _handleContextualResolvable, _handleResolvable, _reportIncompatibleRootType, canOverrideAccessModifiers, constructSpecializedType, constructType, defaultSerializeDateKey, defaultSerializeDateKey, defaultSerializeDateValue, defaultSerializeDateValue, defaultSerializeField, defaultSerializeNull, defaultSerializeValue, findKeySerializer, findNullKeySerializer, findNullValueSerializer, findTypedValueSerializer, findTypedValueSerializer, findValueSerializer, findValueSerializer, getAnnotationIntrospector, getConfig, getDefaultNullKeySerializer, getDefaultNullValueSerializer, getFilterProvider, getLocale, getSerializationView, getTimeZone, getTypeFactory, getUnknownTypeSerializer, isEnabled, isEnabled, setDefaultKeySerializer, setNullKeySerializer, setNullValueSerializer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_NAME_FOR_NULL

protected static final QName ROOT_NAME_FOR_NULL
If all we get to serialize is a null, there's no way to figure out expected root name; so let's just default to something like "<null>"...


_rootNameLookup

protected final XmlRootNameLookup _rootNameLookup
Constructor Detail

XmlSerializerProvider

public XmlSerializerProvider(XmlRootNameLookup rootNames)

XmlSerializerProvider

public XmlSerializerProvider(XmlSerializerProvider src,
                             com.fasterxml.jackson.databind.SerializationConfig config,
                             com.fasterxml.jackson.databind.ser.SerializerFactory f)
Method Detail

createInstance

public com.fasterxml.jackson.databind.ser.DefaultSerializerProvider createInstance(com.fasterxml.jackson.databind.SerializationConfig config,
                                                                                   com.fasterxml.jackson.databind.ser.SerializerFactory jsf)
Specified by:
createInstance in class com.fasterxml.jackson.databind.ser.DefaultSerializerProvider

serializeValue

public void serializeValue(com.fasterxml.jackson.core.JsonGenerator jgen,
                           Object value)
                    throws IOException,
                           com.fasterxml.jackson.core.JsonProcessingException
Overrides:
serializeValue in class com.fasterxml.jackson.databind.ser.DefaultSerializerProvider
Throws:
IOException
com.fasterxml.jackson.core.JsonProcessingException

serializeValue

public void serializeValue(com.fasterxml.jackson.core.JsonGenerator jgen,
                           Object value,
                           com.fasterxml.jackson.databind.JavaType rootType)
                    throws IOException,
                           com.fasterxml.jackson.core.JsonProcessingException
Overrides:
serializeValue in class com.fasterxml.jackson.databind.ser.DefaultSerializerProvider
Throws:
IOException
com.fasterxml.jackson.core.JsonProcessingException

serializeValue

public void serializeValue(com.fasterxml.jackson.core.JsonGenerator jgen,
                           Object value,
                           com.fasterxml.jackson.databind.JavaType rootType,
                           com.fasterxml.jackson.databind.JsonSerializer<Object> ser)
                    throws IOException,
                           com.fasterxml.jackson.core.JsonGenerationException
Overrides:
serializeValue in class com.fasterxml.jackson.databind.ser.DefaultSerializerProvider
Throws:
IOException
com.fasterxml.jackson.core.JsonGenerationException

_initWithRootName

protected void _initWithRootName(com.fasterxml.jackson.core.JsonGenerator jgen,
                                 QName rootName)
                          throws IOException,
                                 com.fasterxml.jackson.core.JsonProcessingException
Throws:
IOException
com.fasterxml.jackson.core.JsonProcessingException


Copyright © 2012 FasterXML. All Rights Reserved.