Class TypeSerializerBase

java.lang.Object
tools.jackson.databind.jsontype.TypeSerializer
tools.jackson.databind.jsontype.impl.TypeSerializerBase
Direct Known Subclasses:
AsArrayTypeSerializer, AsDeductionTypeSerializer, AsExistingPropertyTypeSerializer, AsExternalTypeSerializer, AsPropertyTypeSerializer, AsWrapperTypeSerializer

public abstract class TypeSerializerBase extends TypeSerializer
  • Field Details

  • Constructor Details

  • Method Details

    • 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
    • getPropertyName

      public String getPropertyName()
      Description copied from class: TypeSerializer
      Name of property that contains type information, if property-based inclusion is used.
      Specified by:
      getPropertyName in class TypeSerializer
    • getTypeIdResolver

      public TypeIdResolver getTypeIdResolver()
      Description copied from class: TypeSerializer
      Accessor for object that handles conversions between types and matching type ids.
      Specified by:
      getTypeIdResolver in class TypeSerializer
    • writeTypePrefix

      public tools.jackson.core.type.WritableTypeId writeTypePrefix(tools.jackson.core.JsonGenerator g, SerializationContext ctxt, tools.jackson.core.type.WritableTypeId idMetadata) throws tools.jackson.core.JacksonException
      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.
      Specified by:
      writeTypePrefix in class TypeSerializer
      Parameters:
      g - Generator to use for outputting type id and possible wrapping
      idMetadata - Details of what type id is to be written, how.
      Throws:
      tools.jackson.core.JacksonException
    • writeTypeSuffix

      public tools.jackson.core.type.WritableTypeId writeTypeSuffix(tools.jackson.core.JsonGenerator g, SerializationContext ctxt, tools.jackson.core.type.WritableTypeId idMetadata) throws tools.jackson.core.JacksonException
      Description copied from class: TypeSerializer
      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 to writeTypePrefix(...).
      Specified by:
      writeTypeSuffix in class TypeSerializer
      Parameters:
      g - Generator to use for outputting type id and possible wrapping
      idMetadata - Details of what type id is to be written, how.
      Throws:
      tools.jackson.core.JacksonException
    • _generateTypeId

      protected void _generateTypeId(DatabindContext ctxt, tools.jackson.core.type.WritableTypeId idMetadata)
      Helper method that will generate type id to use, if not already passed.
    • idFromValue

      protected String idFromValue(DatabindContext ctxt, Object value)
    • idFromValueAndType

      protected String idFromValueAndType(DatabindContext ctxt, Object value, Class<?> type)
    • handleMissingId

      protected void handleMissingId(Object value)