diff --git a/src/main/java/tools/jackson/databind/ser/bean/BeanSerializerBase.java b/src/main/java/tools/jackson/databind/ser/bean/BeanSerializerBase.java index 7285d91e33..bdf7b805aa 100644 --- a/src/main/java/tools/jackson/databind/ser/bean/BeanSerializerBase.java +++ b/src/main/java/tools/jackson/databind/ser/bean/BeanSerializerBase.java @@ -80,6 +80,15 @@ public abstract class BeanSerializerBase */ final protected JsonFormat.Shape _serializationShape; + /** + * Name of a bean property whose serialized name equals the + * {@code EXTERNAL_PROPERTY} type id name of this type's polymorphic + * {@link TypeSerializer}, if any. Computed in {@link #resolve}. When + * non-null, {@link #serializeWithType} suppresses the otherwise-emitted + * duplicate type id key so the bean's own property wins ([databind#2844]). + */ + protected String _externalTypeIdToSuppress; + /* /********************************************************************** /* Life-cycle: constructors @@ -137,6 +146,7 @@ protected BeanSerializerBase(BeanSerializerBase src, _objectIdWriter = src._objectIdWriter; _propertyFilterId = src._propertyFilterId; _serializationShape = src._serializationShape; + _externalTypeIdToSuppress = src._externalTypeIdToSuppress; } protected BeanSerializerBase(BeanSerializerBase src, @@ -157,6 +167,7 @@ protected BeanSerializerBase(BeanSerializerBase src, _objectIdWriter = objectIdWriter; _propertyFilterId = filterId; _serializationShape = src._serializationShape; + _externalTypeIdToSuppress = src._externalTypeIdToSuppress; } protected BeanSerializerBase(BeanSerializerBase src, Set toIgnore, Set toInclude) @@ -189,6 +200,22 @@ protected BeanSerializerBase(BeanSerializerBase src, Set toIgnore, Set