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/module/SimpleValueInstantiators.java

    package com.fasterxml.jackson.databind.module;
    
    import java.util.HashMap;
    
    import com.fasterxml.jackson.databind.BeanDescription;
    import com.fasterxml.jackson.databind.DeserializationConfig;
    import com.fasterxml.jackson.databind.deser.ValueInstantiator;
    import com.fasterxml.jackson.databind.deser.ValueInstantiators;
    import com.fasterxml.jackson.databind.type.ClassKey;
    
    public class SimpleValueInstantiators
        extends ValueInstantiators.Base
        implements java.io.Serializable
    {
        private static final long serialVersionUID = -8929386427526115130L;
    
        /**
         * Mappings from raw (type-erased, i.e. non-generic) types
         * to matching {@link ValueInstantiator} instances.
         */
        protected HashMap<ClassKey,ValueInstantiator> _classMappings;
    
        /*
        /**********************************************************
        /* Life-cycle, construction and configuring
        /**********************************************************
         */
    
        public SimpleValueInstantiators()
        {
            _classMappings = new HashMap<ClassKey,ValueInstantiator>();        
        }
        
        public SimpleValueInstantiators addValueInstantiator(Class<?> forType,
                ValueInstantiator inst)
        {
            _classMappings.put(new ClassKey(forType), inst);
            return this;
        }
        
        @Override
        public ValueInstantiator findValueInstantiator(DeserializationConfig config,
                BeanDescription beanDesc, ValueInstantiator defaultInstantiator)
        {
            ValueInstantiator inst = _classMappings.get(new ClassKey(beanDesc.getBeanClass()));
            return (inst == null) ? defaultInstantiator : inst;
        }
    }
    

    com/fasterxml/jackson/databind/module/SimpleValueInstantiators.java

     

    ⇒ Jackson Annotations Source Code

    ⇐ Download and Install Jackson Binary Package

    ⇑ Downloading and Reviewing jackson-*.jar

    ⇑⇑ Jackson - Java JSON library

    2022-03-29, 32005👍, 0💬