Class TypeSerializerBase

    • Method Detail

      • getTypeInclusion

        public abstract 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 class TypeSerializer
      • writeTypeSuffix

        public WritableTypeId writeTypeSuffix​(JsonGenerator g,
                                              WritableTypeId idMetadata)
                                       throws IOException
        Description copied from class: TypeSerializer
        Method that should be called after TypeSerializer.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);
        Specified by:
        writeTypeSuffix in class TypeSerializer