Top Description Fields Constructors Methods
com.fasterxml.jackson.dataformat.xml

public Class JacksonXmlModule

extends SimpleModule
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
com.fasterxml.jackson.databind.AnnotationIntrospector, com.fasterxml.jackson.databind.module.SimpleModule, com.fasterxml.jackson.databind.ser.SerializerFactory, com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser, .XmlBeanDeserializerModifier, com.fasterxml.jackson.dataformat.xml.ser.XmlBeanSerializerModifier

Module that implements most functionality needed to support producing and consuming XML instead of JSON, used by XmlMapper for registering handlers for XML-specific processing.

Note

please do NOT register this directly on XmlMapper: mapper registers an instance (either one explicitly given in constructor, or, if none, one it configures) and attempts to re-register is unlikely to work as you'd expect.

Field Summary

Modifier and TypeField and Description
protected boolean
_cfgDefaultUseWrapper

Determination of whether indexed properties (arrays, Lists) that are not explicitly annotated (with com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper or equivalent) should default to using implicit wrapper (with same name as property) or not.

protected String
_cfgNameForTextElement

Name used for pseudo-property used for returning XML Text value (which does not have actual element name to use).

protected SerializerFactory
private static final long
Inherited from com.fasterxml.jackson.databind.module.SimpleModule:
_abstractTypes_deserializerModifier_deserializers_hasExplicitName_keyDeserializers_keySerializers_mixins_name_namingStrategy_serializerModifier_serializers_subtypes_valueInstantiators_version

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected AnnotationIntrospector
public JacksonXmlModule
overrideSerializerFactory(SerializerFactory factory)

Method to use for overriding default SerializerFactory used

public SerializerFactory
public void
setDefaultUseWrapper(boolean
Whether to enable or disable "use wrapper for non-annotated List properties"
state
)

Method that can be used to define whether AnnotationIntrospector we register will use wrapper for indexed (List, array) properties or not, if there are no explicit annotations.

public void
setupModule(Module.SetupContext context)

Overrides com.fasterxml.jackson.databind.module.SimpleModule.setupModule.

Standard implementation handles registration of all configured customizations: it is important that sub-classes call this implementation (usually before additional custom logic) if they choose to override it; otherwise customizations will not be registered.

public void
setXMLTextElementName(String
Virtual name to use when exposing XML character data sections
name
)

Method that can be used to define alternate "virtual name" to use for XML CDATA segments; that is, text values.

Inherited from com.fasterxml.jackson.databind.module.SimpleModule:
_checkNotNulladdAbstractTypeMappingaddDeserializeraddKeyDeserializeraddKeySerializeraddSerializeraddSerializeraddValueInstantiatorgetModuleNamegetTypeIdregisterSubtypesregisterSubtypesregisterSubtypessetAbstractTypessetDeserializerModifiersetDeserializerssetKeyDeserializerssetKeySerializerssetMixInAnnotationsetNamingStrategysetSerializerModifiersetSerializerssetValueInstantiatorsversion

Field Detail

_cfgDefaultUseWrapperback to summary
protected boolean _cfgDefaultUseWrapper

Determination of whether indexed properties (arrays, Lists) that are not explicitly annotated (with com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper or equivalent) should default to using implicit wrapper (with same name as property) or not. If enabled, wrapping is used by default; if false, it is not.

Note that JAXB annotation introspector always assumes "do not wrap by default". Jackson annotations have different default due to backwards compatibility.

Since
2.1
_cfgNameForTextElementback to summary
protected String _cfgNameForTextElement

Name used for pseudo-property used for returning XML Text value (which does not have actual element name to use). Defaults to empty String, but may be changed for inter-operability reasons: JAXB, for example, uses "value" as name.

Since
2.1
_serializerFactoryOverrideback to summary
protected SerializerFactory _serializerFactoryOverride

Optional override for SerializerFactory used by XmlMapper. Needed to allow proper override and configurability using custom {@SerializerFactory } implementations.

Since
2.18.2
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.module.SimpleModule.serialVersionUID.

Constructor Detail

JacksonXmlModuleback to summary
public JacksonXmlModule()

Method Detail

_constructIntrospectorback to summary
protected AnnotationIntrospector _constructIntrospector()
overrideSerializerFactoryback to summary
public JacksonXmlModule overrideSerializerFactory(SerializerFactory factory)

Method to use for overriding default SerializerFactory used

Since
2.18.2
serializerFactoryOverrideback to summary
public SerializerFactory serializerFactoryOverride()
Since
2.18.2
setDefaultUseWrapperback to summary
public void setDefaultUseWrapper(boolean state)

Method that can be used to define whether AnnotationIntrospector we register will use wrapper for indexed (List, array) properties or not, if there are no explicit annotations. See com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper for details.

Note that method MUST be called before registering the module; otherwise change will not have any effect.

Parameters
state:boolean

Whether to enable or disable "use wrapper for non-annotated List properties"

Since
2.1
setupModuleback to summary
public void setupModule(Module.SetupContext context)

Overrides com.fasterxml.jackson.databind.module.SimpleModule.setupModule.

Doc from com.fasterxml.jackson.databind.module.SimpleModule.setupModule.

Standard implementation handles registration of all configured customizations: it is important that sub-classes call this implementation (usually before additional custom logic) if they choose to override it; otherwise customizations will not be registered.

Annotations
@SuppressWarnings:deprecation
@Override
setXMLTextElementNameback to summary
public void setXMLTextElementName(String name)

Method that can be used to define alternate "virtual name" to use for XML CDATA segments; that is, text values. Default name is empty String (""); but some frameworks use other names: JAXB, for example, uses "value".

Note that method MUST be called before registering the module; otherwise change will not have any effect.

Parameters
name:String

Virtual name to use when exposing XML character data sections

Since
2.1