Class TypeSerializerBase
java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.jsontype.TypeSerializer
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.jsontype.impl.TypeSerializerBase
- Direct Known Subclasses:
AsArrayTypeSerializer
,AsDeductionTypeSerializer
,AsExternalTypeSerializer
,AsWrapperTypeSerializer
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
TypeSerializerBase
(TypeIdResolver idRes, BeanProperty property) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
_generateTypeId
(WritableTypeId idMetadata) Helper method that will generate type id to use, if not already passed.Name of property that contains type information, if property-based inclusion is used.Accessor for object that handles conversions between types and matching type ids.abstract JsonTypeInfo.As
Accessor for type information inclusion method that serializer uses; indicates how type information is embedded in resulting JSON.protected void
handleMissingId
(Object value) protected String
idFromValue
(Object value) protected String
idFromValueAndType
(Object value, Class<?> type) 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.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 edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.jsontype.TypeSerializer
_writeLegacySuffix, forProperty, typeId, typeId, typeId, writeCustomTypePrefixForArray, writeCustomTypePrefixForObject, writeCustomTypePrefixForScalar, writeCustomTypeSuffixForArray, writeCustomTypeSuffixForObject, writeCustomTypeSuffixForScalar, writeTypePrefixForArray, writeTypePrefixForArray, writeTypePrefixForObject, writeTypePrefixForObject, writeTypePrefixForScalar, writeTypePrefixForScalar, writeTypeSuffixForArray, writeTypeSuffixForObject, writeTypeSuffixForScalar
-
Field Details
-
_idResolver
-
_property
-
-
Constructor Details
-
TypeSerializerBase
-
-
Method Details
-
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 classTypeSerializer
-
getPropertyName
Description copied from class:TypeSerializer
Name of property that contains type information, if property-based inclusion is used.- Specified by:
getPropertyName
in classTypeSerializer
-
getTypeIdResolver
Description copied from class:TypeSerializer
Accessor for object that handles conversions between types and matching type ids.- Specified by:
getTypeIdResolver
in classTypeSerializer
-
writeTypePrefix
public WritableTypeId writeTypePrefix(JsonGenerator g, WritableTypeId idMetadata) throws 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.- Specified by:
writeTypePrefix
in classTypeSerializer
- Parameters:
g
- Generator to use for outputting type id and possible wrappingidMetadata
- Details of what type id is to be written, how.- Throws:
IOException
-
writeTypeSuffix
public WritableTypeId writeTypeSuffix(JsonGenerator g, WritableTypeId idMetadata) throws 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);
- Specified by:
writeTypeSuffix
in classTypeSerializer
- Throws:
IOException
-
_generateTypeId
Helper method that will generate type id to use, if not already passed.- Since:
- 2.9
-
idFromValue
-
idFromValueAndType
-
handleMissingId
-