Class XmlNullSuppressingBeanPropertyWriter

java.lang.Object
tools.jackson.databind.introspect.ConcreteBeanPropertyBase
tools.jackson.databind.ser.PropertyWriter
tools.jackson.databind.ser.BeanPropertyWriter
tools.jackson.dataformat.xml.ser.XmlNullSuppressingBeanPropertyWriter
All Implemented Interfaces:
tools.jackson.core.util.Named, tools.jackson.databind.BeanProperty, tools.jackson.databind.util.FullyNamed

public class XmlNullSuppressingBeanPropertyWriter extends tools.jackson.databind.ser.BeanPropertyWriter
Property writer sub-class used for unwrapped (no wrapper element) Collection/array properties. It suppresses output of null values entirely, so that a null collection is simply omitted -- consistent with the wrapped-collection case handled by XmlBeanPropertyWriter (which also omits null collections).

Without this, an unwrapped null collection would be written via the standard null handling as an xsi:nil element (when WRITE_NULLS_AS_XSI_NIL is enabled, which it is by default in 3.x). That output is indistinguishable, on read, from a collection containing a single null element (see [dataformat-xml#871]), so for null collections we omit the element instead.

Since:
3.2.1
  • Nested Class Summary

    Nested classes/interfaces inherited from interface tools.jackson.databind.BeanProperty

    tools.jackson.databind.BeanProperty.Bogus, tools.jackson.databind.BeanProperty.Std

    Nested classes/interfaces inherited from interface tools.jackson.core.util.Named

    tools.jackson.core.util.Named.StringAsNamed
  • Field Summary

    Fields inherited from class tools.jackson.databind.ser.BeanPropertyWriter

    _accessor, _applyView, _cfgSerializationType, _contextAnnotations, _declaredType, _dynamicSerializers, _includeInViews, _inclusion, _internalSettings, _member, _name, _nonTrivialBaseType, _nullSerializer, _serializer, _suppressableValue, _suppressNulls, _typeSerializer, _wrapperName, MARKER_FOR_EMPTY

    Fields inherited from class tools.jackson.databind.introspect.ConcreteBeanPropertyBase

    _aliases, _metadata

    Fields inherited from interface tools.jackson.databind.BeanProperty

    EMPTY_FORMAT, EMPTY_INCLUDE
  • Constructor Summary

    Constructors
    Constructor
    Description
    XmlNullSuppressingBeanPropertyWriter(tools.jackson.databind.ser.BeanPropertyWriter wrapped)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    serializeAsProperty(Object bean, tools.jackson.core.JsonGenerator g, tools.jackson.databind.SerializationContext ctxt)
     

    Methods inherited from class tools.jackson.databind.ser.BeanPropertyWriter

    _depositSchemaProperty, _findAndAddDynamic, _handleSelfReference, _new, assignNullSerializer, assignSerializer, assignTypeSerializer, depositSchemaProperty, findPropertyInclusion, fixAccess, get, getAnnotation, getContextAnnotation, getFullName, getInternalSetting, getMember, getName, getSerializationType, getSerializedName, getSerializer, getType, getTypeSerializer, getViews, getWrapperName, hasNullSerializer, hasSerializer, isUnwrapping, removeInternalSetting, rename, serializeAsElement, serializeAsOmittedElement, serializeAsOmittedProperty, setInternalSetting, setNonTrivialBaseType, toString, unwrappingWriter, willSuppressNulls, wouldConflictWithName

    Methods inherited from class tools.jackson.databind.ser.PropertyWriter

    findAnnotation

    Methods inherited from class tools.jackson.databind.introspect.ConcreteBeanPropertyBase

    findAliases, findFormatOverrides, findPropertyFormat, getMetadata, isRequired, isVirtual

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface tools.jackson.databind.util.FullyNamed

    hasName
  • Constructor Details

    • XmlNullSuppressingBeanPropertyWriter

      public XmlNullSuppressingBeanPropertyWriter(tools.jackson.databind.ser.BeanPropertyWriter wrapped)
  • Method Details

    • serializeAsProperty

      public void serializeAsProperty(Object bean, tools.jackson.core.JsonGenerator g, tools.jackson.databind.SerializationContext ctxt) throws Exception
      Overrides:
      serializeAsProperty in class tools.jackson.databind.ser.BeanPropertyWriter
      Throws:
      Exception