Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
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 Databind Source Code files are provided in the source packge (jackson-databind-2.14.0-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/SimpleAbstractTypeResolver.java
package com.fasterxml.jackson.databind.module; import java.lang.reflect.Modifier; import java.util.*; import com.fasterxml.jackson.databind.AbstractTypeResolver; import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.DeserializationConfig; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.type.ClassKey; /** * Simple {@link AbstractTypeResolver} implementation, which is * based on static mapping from abstract super types into * sub types (concrete or abstract), but retaining generic * parameterization. * Can be used for things like specifying which implementation of * {@link java.util.Collection} to use: *<pre> * SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver(); * // To make all properties declared as Collection, List, to LinkedList * resolver.addMapping(Collection.class, LinkedList.class); * resolver.addMapping(List.class, LinkedList.class); *</pre> * Can also be used as an alternative to per-class annotations when defining * concrete implementations; however, only works with abstract types (since * this is only called for abstract types) */ public class SimpleAbstractTypeResolver extends AbstractTypeResolver implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * Mappings from super types to subtypes */ protected final HashMap<ClassKey,Class<?>> _mappings = new HashMap<ClassKey,Class<?>>(); /** * Method for adding a mapping from super type to specific subtype. * Arguments will be checked by method, to ensure that <code>superType</code> * is abstract (since resolver is never called for concrete classes); * as well as to ensure that there is supertype/subtype relationship * (to ensure there won't be cycles during resolution). * * @param superType Abstract type to resolve * @param subType Sub-class of superType, to map superTo to * * @return This resolver, to allow chaining of initializations */ public <T> SimpleAbstractTypeResolver addMapping(Class<T> superType, Class<? extends T> subType) { // Sanity checks, just in case someone tries to force typing... if (superType == subType) { throw new IllegalArgumentException("Cannot add mapping from class to itself"); } if (!superType.isAssignableFrom(subType)) { throw new IllegalArgumentException("Cannot add mapping from class "+superType.getName() +" to "+subType.getName()+", as latter is not a subtype of former"); } if (!Modifier.isAbstract(superType.getModifiers())) { throw new IllegalArgumentException("Cannot add mapping from class "+superType.getName() +" since it is not abstract"); } _mappings.put(new ClassKey(superType), subType); return this; } @Override public JavaType findTypeMapping(DeserializationConfig config, JavaType type) { // this is the main mapping base, so let's Class<?> src = type.getRawClass(); Class<?> dst = _mappings.get(new ClassKey(src)); if (dst == null) { return null; } // 09-Aug-2015, tatu: Instead of direct call via JavaType, better use TypeFactory return config.getTypeFactory().constructSpecializedType(type, dst); } @Override @Deprecated public JavaType resolveAbstractType(DeserializationConfig config, JavaType type){ // never materialize anything, so: return null; } @Override public JavaType resolveAbstractType(DeserializationConfig config, BeanDescription typeDesc) { // never materialize anything, so: return null; } }
⏎ com/fasterxml/jackson/databind/module/SimpleAbstractTypeResolver.java
Or download all of them as a single archive file:
File name: jackson-databind-2.14.0-sources.jar File size: 1187952 bytes Release date: 2022-11-05 Download
⇒ Jackson Annotations Source Code
⇐ Download and Install Jackson Binary Package
2022-03-29, 81104👍, 0💬
Popular Posts:
Apache Axis2 is the core engine for Web services. It is a complete re-design and re-write of the wid...
How to merge two JAR files with "jar" commands? I am tired of specifying multiple JAR files in the c...
How to download and install JDK (Java Development Kit) 1.3? If you want to write Java applications, ...
JDK 11 jdk.jconsole.jmod is the JMOD file for JDK 11 JConsole tool, which can be invoked by the "jco...
Saxon-HE (home edition) is an open source product available under the Mozilla Public License. It pro...