Class AsDeductionTypeSerializer
- java.lang.Object
-
- com.fasterxml.jackson.databind.jsontype.TypeSerializer
-
- com.fasterxml.jackson.databind.jsontype.impl.TypeSerializerBase
-
- com.fasterxml.jackson.databind.jsontype.impl.AsDeductionTypeSerializer
-
public class AsDeductionTypeSerializer extends TypeSerializerBase
- Since:
- 2.14.2
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AsDeductionTypeSerializer
forProperty(BeanProperty prop)
Method called to create contextual version, to be used for values of given property.JsonTypeInfo.As
getTypeInclusion()
Accessor for type information inclusion method that serializer uses; indicates how type information is embedded in resulting JSON.static AsDeductionTypeSerializer
instance()
WritableTypeId
writeTypePrefix(JsonGenerator g, WritableTypeId idMetadata)
Method called to write initial part of type information for given value, along with possible wrapping to use: details are specified by `typeId` argument.WritableTypeId
writeTypeSuffix(JsonGenerator g, WritableTypeId idMetadata)
Method that should be called afterTypeSerializer.writeTypePrefix(JsonGenerator, WritableTypeId)
and matching value write have been called, passingWritableTypeId
returned.-
Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.TypeSerializerBase
getPropertyName, getTypeIdResolver
-
Methods inherited from class com.fasterxml.jackson.databind.jsontype.TypeSerializer
typeId, typeId, typeId, writeCustomTypePrefixForArray, writeCustomTypePrefixForObject, writeCustomTypePrefixForScalar, writeCustomTypeSuffixForArray, writeCustomTypeSuffixForObject, writeCustomTypeSuffixForScalar, writeTypePrefixForArray, writeTypePrefixForArray, writeTypePrefixForObject, writeTypePrefixForObject, writeTypePrefixForScalar, writeTypePrefixForScalar, writeTypeSuffixForArray, writeTypeSuffixForObject, writeTypeSuffixForScalar
-
-
-
-
Method Detail
-
instance
public static AsDeductionTypeSerializer instance()
-
forProperty
public AsDeductionTypeSerializer forProperty(BeanProperty prop)
Description copied from class:TypeSerializer
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 (forCollection
orMap
valued properties).- Specified by:
forProperty
in classTypeSerializer
-
getTypeInclusion
public JsonTypeInfo.As getTypeInclusion()
Description copied from class:TypeSerializer
Accessor for type information inclusion method that serializer uses; indicates how type information is embedded in resulting JSON.- Specified by:
getTypeInclusion
in classTypeSerializerBase
-
writeTypePrefix
public WritableTypeId writeTypePrefix(JsonGenerator g, WritableTypeId idMetadata) throws java.io.IOException
Description copied from class:TypeSerializer
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.See
TypeSerializer.writeTypeSuffix(JsonGenerator, WritableTypeId)
for a complete example of typical usage.- Overrides:
writeTypePrefix
in classTypeSerializerBase
- Parameters:
g
- Generator to use for outputting type id and possible wrappingidMetadata
- Details of what type id is to be written, how.- Throws:
java.io.IOException
-
writeTypeSuffix
public WritableTypeId writeTypeSuffix(JsonGenerator g, WritableTypeId idMetadata) throws java.io.IOException
Description copied from class:TypeSerializer
Method that should be called afterTypeSerializer.writeTypePrefix(JsonGenerator, WritableTypeId)
and matching value write have been called, passingWritableTypeId
returned. Usual idiom is:// Indicator generator that type identifier may be needed; generator may write // one as suggested, modify information, or take some other action // NOTE! For Object/Array types, this will ALSO write start marker! WritableTypeId typeIdDef = typeSer.writeTypePrefix(gen, typeSer.typeId(value, JsonToken.START_OBJECT)); // serializing actual value for which TypeId may have been written... like // NOTE: do NOT write START_OBJECT before OR END_OBJECT after: g.writeStringField("message", "Hello, world!" // matching type suffix call to let generator chance to add suffix, if any // NOTE! For Object/Array types, this will ALSO write end marker! typeSer.writeTypeSuffix(gen, typeIdDef);
- Overrides:
writeTypeSuffix
in classTypeSerializerBase
- Throws:
java.io.IOException
-
-