Class ExternalTypeHandler


  • public class ExternalTypeHandler
    extends java.lang.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 Detail

      • ExternalTypeHandler

        protected ExternalTypeHandler​(JavaType beanType,
                                      com.fasterxml.jackson.databind.deser.impl.ExternalTypeHandler.ExtTypedProperty[] properties,
                                      java.util.Map<java.lang.String,​java.lang.Object> nameToPropertyIndex,
                                      java.lang.String[] typeIds,
                                      TokenBuffer[] tokens)
    • Method Detail

      • start

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

        public boolean handlePropertyValue​(com.fasterxml.jackson.core.JsonParser p,
                                           DeserializationContext ctxt,
                                           java.lang.String propName,
                                           java.lang.Object bean)
                                    throws java.io.IOException
        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:
        java.io.IOException
      • complete

        public java.lang.Object complete​(com.fasterxml.jackson.core.JsonParser p,
                                         DeserializationContext ctxt,
                                         java.lang.Object bean)
                                  throws java.io.IOException
        Method called after JSON Object closes, and has to ensure that all external type ids have been handled.
        Throws:
        java.io.IOException
      • complete

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

        protected final java.lang.Object _deserialize​(com.fasterxml.jackson.core.JsonParser p,
                                                      DeserializationContext ctxt,
                                                      int index,
                                                      java.lang.String typeId)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • _deserializeAndSet

        protected final void _deserializeAndSet​(com.fasterxml.jackson.core.JsonParser p,
                                                DeserializationContext ctxt,
                                                java.lang.Object bean,
                                                int index,
                                                java.lang.String typeId)
                                         throws java.io.IOException
        Throws:
        java.io.IOException