Class ExternalTypeHandler

java.lang.Object
tools.jackson.databind.deser.impl.ExternalTypeHandler

public class ExternalTypeHandler extends Object
Helper class that is used to flatten JSON structure when using "external type id" (see JsonTypeInfo.As.EXTERNAL_PROPERTY). This is needed to store temporary state and buffer tokens, as the structure is rearranged a bit so that actual type deserializer can resolve type and finalize deserialization.
  • Constructor Details

    • ExternalTypeHandler

      protected ExternalTypeHandler(JavaType beanType, tools.jackson.databind.deser.impl.ExternalTypeHandler.ExtTypedProperty[] properties, Map<String,Object> nameToPropertyIndex, String[] typeIds, TokenBuffer[] tokens)
    • ExternalTypeHandler

      protected ExternalTypeHandler(ExternalTypeHandler h)
  • Method Details

    • builder

      public static ExternalTypeHandler.Builder builder(JavaType beanType)
    • start

      public ExternalTypeHandler start()
      Method called to start collection process by creating non-blueprint instances.
    • handleTypePropertyValue

      public boolean handleTypePropertyValue(tools.jackson.core.JsonParser p, DeserializationContext ctxt, String propName, Object bean) throws tools.jackson.core.JacksonException
      Method called to see if given property/value pair is an external type id; and if so handle it. This is only to be called in case containing POJO has similarly named property as the external type id AND value is of scalar type: otherwise handlePropertyValue(tools.jackson.core.JsonParser, tools.jackson.databind.DeserializationContext, java.lang.String, java.lang.Object) should be called instead.
      Throws:
      tools.jackson.core.JacksonException
    • handlePropertyValue

      public boolean handlePropertyValue(tools.jackson.core.JsonParser p, DeserializationContext ctxt, String propName, Object bean) throws tools.jackson.core.JacksonException
      Method called to ask handler to handle value of given property, at point where parser points to the first token of the value. Handling can mean either resolving type id it contains (if it matches type property name), or by buffering the value for further use.
      Returns:
      True, if the given property was properly handled
      Throws:
      tools.jackson.core.JacksonException
    • complete

      public Object complete(tools.jackson.core.JsonParser p, DeserializationContext ctxt, Object bean) throws tools.jackson.core.JacksonException
      Method called after JSON Object closes, and has to ensure that all external type ids have been handled.
      Throws:
      tools.jackson.core.JacksonException
    • complete

      public Object complete(tools.jackson.core.JsonParser p, DeserializationContext ctxt, PropertyValueBuffer buffer, PropertyBasedCreator creator) throws tools.jackson.core.JacksonException
      Variant called when creation of the POJO involves buffering of creator properties as well as property-based creator.
      Throws:
      tools.jackson.core.JacksonException
    • _deserialize

      protected final Object _deserialize(tools.jackson.core.JsonParser p, DeserializationContext ctxt, int index, String typeId) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _deserializeMissingToken

      protected final Object _deserializeMissingToken(tools.jackson.core.JsonParser p, DeserializationContext ctxt, int index, String typeId) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _deserializeAndSet

      protected final void _deserializeAndSet(tools.jackson.core.JsonParser p, DeserializationContext ctxt, Object bean, int index, String typeId) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException