public class AsDeductionTypeSerializer extends TypeSerializerBase
_idResolver, _property| Modifier | Constructor and Description |
|---|---|
protected |
AsDeductionTypeSerializer() |
| Modifier and Type | Method and Description |
|---|---|
AsDeductionTypeSerializer |
forProperty(BeanProperty prop)
Method called to create contextual version, to be used for
values of given property.
|
com.fasterxml.jackson.annotation.JsonTypeInfo.As |
getTypeInclusion()
Accessor for type information inclusion method
that serializer uses; indicates how type information
is embedded in resulting JSON.
|
static AsDeductionTypeSerializer |
instance() |
com.fasterxml.jackson.core.type.WritableTypeId |
writeTypePrefix(com.fasterxml.jackson.core.JsonGenerator g,
com.fasterxml.jackson.core.type.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.
|
com.fasterxml.jackson.core.type.WritableTypeId |
writeTypeSuffix(com.fasterxml.jackson.core.JsonGenerator g,
com.fasterxml.jackson.core.type.WritableTypeId idMetadata)
Method that should be called after
TypeSerializer.writeTypePrefix(JsonGenerator, WritableTypeId)
and matching value write have been called, passing WritableTypeId returned. |
_generateTypeId, getPropertyName, getTypeIdResolver, handleMissingId, idFromValue, idFromValueAndType_writeLegacySuffix, typeId, typeId, typeId, writeCustomTypePrefixForArray, writeCustomTypePrefixForObject, writeCustomTypePrefixForScalar, writeCustomTypeSuffixForArray, writeCustomTypeSuffixForObject, writeCustomTypeSuffixForScalar, writeTypePrefixForArray, writeTypePrefixForArray, writeTypePrefixForObject, writeTypePrefixForObject, writeTypePrefixForScalar, writeTypePrefixForScalar, writeTypeSuffixForArray, writeTypeSuffixForObject, writeTypeSuffixForScalarpublic static AsDeductionTypeSerializer instance()
public AsDeductionTypeSerializer forProperty(BeanProperty prop)
TypeSerializerCollection or Map
valued properties).forProperty in class TypeSerializerpublic com.fasterxml.jackson.annotation.JsonTypeInfo.As getTypeInclusion()
TypeSerializergetTypeInclusion in class TypeSerializerBasepublic com.fasterxml.jackson.core.type.WritableTypeId writeTypePrefix(com.fasterxml.jackson.core.JsonGenerator g,
com.fasterxml.jackson.core.type.WritableTypeId idMetadata)
throws IOException
TypeSerializer
See TypeSerializer.writeTypeSuffix(JsonGenerator, WritableTypeId) for a complete
example of typical usage.
writeTypePrefix in class TypeSerializerBaseg - Generator to use for outputting type id and possible wrappingidMetadata - Details of what type id is to be written, how.IOExceptionpublic com.fasterxml.jackson.core.type.WritableTypeId writeTypeSuffix(com.fasterxml.jackson.core.JsonGenerator g,
com.fasterxml.jackson.core.type.WritableTypeId idMetadata)
throws IOException
TypeSerializerTypeSerializer.writeTypePrefix(JsonGenerator, WritableTypeId)
and matching value write have been called, passing WritableTypeId 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);
writeTypeSuffix in class TypeSerializerBaseIOExceptionCopyright © 2008–2023 FasterXML. All rights reserved.