java.lang.Object
tools.jackson.databind.jsontype.TypeSerializer
- Direct Known Subclasses:
NoOpTypeSerializer,TypeSerializerBase
Interface for serializing type information regarding instances of specified
base type (super class), so that exact subtype can be properly deserialized
later on. These instances are to be called by regular
ValueSerializers using proper contextual
calls, to add type information using mechanism type serializer was
configured with.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract TypeSerializerforProperty(SerializationContext ctxt, BeanProperty prop) Method called to create contextual version, to be used for values of given property.abstract StringName of property that contains type information, if property-based inclusion is used.abstract TypeIdResolverAccessor for object that handles conversions between types and matching type ids.abstract JsonTypeInfo.AsAccessor for type information inclusion method that serializer uses; indicates how type information is embedded in resulting JSON.tools.jackson.core.type.WritableTypeIdtools.jackson.core.type.WritableTypeIdFactory method for constructing type id value object to pass towriteTypePrefix(tools.jackson.core.JsonGenerator, tools.jackson.databind.SerializationContext, tools.jackson.core.type.WritableTypeId).tools.jackson.core.type.WritableTypeIdabstract tools.jackson.core.type.WritableTypeIdwriteTypePrefix(tools.jackson.core.JsonGenerator g, SerializationContext ctxt, tools.jackson.core.type.WritableTypeId typeId) Method called to write initial part of type information for given value, along with possible wrapping to use: details are specified by `typeId` argument.abstract tools.jackson.core.type.WritableTypeIdwriteTypeSuffix(tools.jackson.core.JsonGenerator g, SerializationContext ctxt, tools.jackson.core.type.WritableTypeId typeId) Method called to write the "closing" part of type information for given value, along with possible closing wrapping to use: details are specified by `typeId` argument, which should be one returned from an earlier matching call towriteTypePrefix(...).
-
Constructor Details
-
TypeSerializer
public TypeSerializer()
-
-
Method Details
-
forProperty
Method called to create contextual version, to be used for values of given property. This may be the type itself (as is the case for bean properties), or values contained (forCollectionorMapvalued properties).NOTE: since 3.0 has received context object as first argument.
-
getTypeInclusion
Accessor for type information inclusion method that serializer uses; indicates how type information is embedded in resulting JSON. -
getPropertyName
Name of property that contains type information, if property-based inclusion is used. -
getTypeIdResolver
Accessor for object that handles conversions between types and matching type ids. -
typeId
public tools.jackson.core.type.WritableTypeId typeId(Object value, tools.jackson.core.JsonToken valueShape) Factory method for constructing type id value object to pass towriteTypePrefix(tools.jackson.core.JsonGenerator, tools.jackson.databind.SerializationContext, tools.jackson.core.type.WritableTypeId). -
typeId
-
typeId
-
writeTypePrefix
public abstract tools.jackson.core.type.WritableTypeId writeTypePrefix(tools.jackson.core.JsonGenerator g, SerializationContext ctxt, tools.jackson.core.type.WritableTypeId typeId) throws tools.jackson.core.JacksonException Method called to write initial part of type information for given value, along with possible wrapping to use: details are specified by `typeId` argument. Note that for structured types (Object, Array), this call will add necessary start token so it should NOT be explicitly written, unlike with non-type-id value writes.- Parameters:
g- Generator to use for outputting type id and possible wrappingtypeId- Details of what type id is to be written, how.- Throws:
tools.jackson.core.JacksonException
-
writeTypeSuffix
public abstract tools.jackson.core.type.WritableTypeId writeTypeSuffix(tools.jackson.core.JsonGenerator g, SerializationContext ctxt, tools.jackson.core.type.WritableTypeId typeId) throws tools.jackson.core.JacksonException Method called to write the "closing" part of type information for given value, along with possible closing wrapping to use: details are specified by `typeId` argument, which should be one returned from an earlier matching call towriteTypePrefix(...).- Parameters:
g- Generator to use for outputting type id and possible wrappingtypeId- Details of what type id is to be written, how.- Throws:
tools.jackson.core.JacksonException
-