Jackson Data Binding Source Code

Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".

  • Jackson Data Binding module allows you to converts JSON to and from POJO (Plain Old Java Object) using property accessor or using annotations.
  • Jackson Databind Source Code files are provided in the source packge (jackson-databind-2.12.4-sources.jar). You can download it at Jackson Maven Website.

    You can also browse Jackson Databind Source Code below:

    ✍: FYIcenter.com

    com/fasterxml/jackson/databind/deser/impl/ValueInjector.java

    package com.fasterxml.jackson.databind.deser.impl;
    
    import java.io.IOException;
    
    import com.fasterxml.jackson.databind.*;
    import com.fasterxml.jackson.databind.introspect.AnnotatedMember;
    
    /**
     * Class that encapsulates details of value injection that occurs before
     * deserialization of a POJO. Details include information needed to find
     * injectable value (logical id) as well as method used for assigning
     * value (setter or field)
     */
    public class ValueInjector
        extends BeanProperty.Std
    {
        private static final long serialVersionUID = 1L;
    
        /**
         * Identifier used for looking up value to inject
         */
        protected final Object _valueId;
    
        public ValueInjector(PropertyName propName, JavaType type,
                AnnotatedMember mutator, Object valueId)
        {
            super(propName, type, null, mutator, PropertyMetadata.STD_OPTIONAL);
            _valueId = valueId;
        }
    
        /**
         * @deprecated in 2.9 (remove from 3.0)
         */
        @Deprecated // see [databind#1835]
        public ValueInjector(PropertyName propName, JavaType type,
                com.fasterxml.jackson.databind.util.Annotations contextAnnotations, // removed from later versions
                AnnotatedMember mutator, Object valueId)
        {
            this(propName, type, mutator, valueId);
        }
    
        public Object findValue(DeserializationContext context, Object beanInstance)
            throws JsonMappingException
        {
            return context.findInjectableValue(_valueId, this, beanInstance);
        }
    
        public void inject(DeserializationContext context, Object beanInstance)
            throws IOException
        {
            _member.setValue(beanInstance, findValue(context, beanInstance));
        }
    }

    com/fasterxml/jackson/databind/deser/impl/ValueInjector.java

     

    ⇒ Jackson Annotations Source Code

    ⇐ Download and Install Jackson Binary Package

    ⇑ Downloading and Reviewing jackson-*.jar

    ⇑⇑ Jackson - Java JSON library

    2022-03-29, 31860👍, 0💬