public class AsExternalTypeSerializer extends TypeSerializerBase
AsPropertyTypeSerializer
.
Note that implementation of serialization is bit cumbersome as we must serialized external type id AFTER object; this because callback only occurs after field name has been written.
Also note that this type of type id inclusion will NOT try to make use of native Type Ids, even if those exist.
Modifier and Type | Field and Description |
---|---|
protected String |
_typePropertyName |
_idResolver, _property
Constructor and Description |
---|
AsExternalTypeSerializer(TypeIdResolver idRes,
BeanProperty property,
String propName) |
Modifier and Type | Method and Description |
---|---|
protected void |
_writeArrayPrefix(Object value,
JsonGenerator g) |
protected void |
_writeArraySuffix(Object value,
JsonGenerator g,
String typeId) |
protected void |
_writeObjectPrefix(Object value,
JsonGenerator g) |
protected void |
_writeObjectSuffix(Object value,
JsonGenerator g,
String typeId) |
protected void |
_writeScalarPrefix(Object value,
JsonGenerator g) |
protected void |
_writeScalarSuffix(Object value,
JsonGenerator g,
String typeId) |
AsExternalTypeSerializer |
forProperty(BeanProperty prop)
Method called to create contextual version, to be used for
values of given property.
|
String |
getPropertyName()
Name of property that contains type information, if
property-based inclusion is used.
|
JsonTypeInfo.As |
getTypeInclusion()
Accessor for type information inclusion method
that serializer uses; indicates how type information
is embedded in resulting JSON.
|
_generateTypeId, getTypeIdResolver, handleMissingId, idFromValue, idFromValueAndType, writeTypePrefix, writeTypeSuffix
_writeLegacySuffix, typeId, typeId, typeId, writeCustomTypePrefixForArray, writeCustomTypePrefixForObject, writeCustomTypePrefixForScalar, writeCustomTypeSuffixForArray, writeCustomTypeSuffixForObject, writeCustomTypeSuffixForScalar, writeTypePrefixForArray, writeTypePrefixForArray, writeTypePrefixForObject, writeTypePrefixForObject, writeTypePrefixForScalar, writeTypePrefixForScalar, writeTypeSuffixForArray, writeTypeSuffixForObject, writeTypeSuffixForScalar
protected final String _typePropertyName
public AsExternalTypeSerializer(TypeIdResolver idRes, BeanProperty property, String propName)
public AsExternalTypeSerializer forProperty(BeanProperty prop)
TypeSerializer
Collection
or Map
valued properties).forProperty
in class TypeSerializer
public String getPropertyName()
TypeSerializer
getPropertyName
in class TypeSerializerBase
public JsonTypeInfo.As getTypeInclusion()
TypeSerializer
getTypeInclusion
in class TypeSerializerBase
protected final void _writeScalarPrefix(Object value, JsonGenerator g) throws IOException
IOException
protected final void _writeObjectPrefix(Object value, JsonGenerator g) throws IOException
IOException
protected final void _writeArrayPrefix(Object value, JsonGenerator g) throws IOException
IOException
protected final void _writeScalarSuffix(Object value, JsonGenerator g, String typeId) throws IOException
IOException
protected final void _writeObjectSuffix(Object value, JsonGenerator g, String typeId) throws IOException
IOException
protected final void _writeArraySuffix(Object value, JsonGenerator g, String typeId) throws IOException
IOException
Copyright © 2020 JBoss by Red Hat. All rights reserved.