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/introspect/TypeResolutionContext.java

    package com.fasterxml.jackson.databind.introspect;
    
    import java.lang.reflect.Type;
    
    import com.fasterxml.jackson.databind.JavaType;
    import com.fasterxml.jackson.databind.type.TypeBindings;
    import com.fasterxml.jackson.databind.type.TypeFactory;
    
    /**
     * Interface that defines API used by members (like {@link AnnotatedMethod})
     * to dynamically resolve types they have.
     *
     * @since 2.7
     */
    public interface TypeResolutionContext {
        public JavaType resolveType(Type t);
    
        public static class Basic
            implements TypeResolutionContext
        {
            private final TypeFactory _typeFactory;
            private final TypeBindings _bindings;
    
            public Basic(TypeFactory tf, TypeBindings b) {
                _typeFactory = tf;
                _bindings = b;
            }
    
            @Override
            public JavaType resolveType(Type type) {
                // 06-Sep-2020, tatu: Careful wrt [databind#2846][databind#2821],
                //     call new method added in 2.12
                return _typeFactory.resolveMemberType(type, _bindings);
            }
    
            /*// debugging
            @Override
            public String toString() {
                return "[TRC.Basic, bindings: "+_bindings+"]";
            }
            */
        }
    
        /**
         * Dummy implementation for case where there are no bindings available
         * (for example, for static methods and fields)
         *
         * @since 2.11.3
         */
        public static class Empty
            implements TypeResolutionContext
        {
            private final TypeFactory _typeFactory;
    
            public Empty(TypeFactory tf) {
                _typeFactory = tf;
            }
    
            @Override
            public JavaType resolveType(Type type) {
                return _typeFactory.constructType(type);
            }
        }
    }
    

    com/fasterxml/jackson/databind/introspect/TypeResolutionContext.java

     

    ⇒ Jackson Annotations Source Code

    ⇐ Download and Install Jackson Binary Package

    ⇑ Downloading and Reviewing jackson-*.jar

    ⇑⇑ Jackson - Java JSON library

    2022-03-29, 32298👍, 0💬