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/ser/impl/ReadOnlyClassToSerializerMap.java
package com.fasterxml.jackson.databind.ser.impl; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.util.LRUMap; import com.fasterxml.jackson.databind.util.TypeKey; /** * Optimized lookup table for accessing two types of serializers; typed * and non-typed. Only accessed from a single thread, so no synchronization * needed for accessors. *<p> * Note that before 2.6 this class was much smaller, and referred most * operations to separate <code>JsonSerializerMap</code>, but in 2.6 * functions were combined. */ public final class ReadOnlyClassToSerializerMap { private final Bucket[] _buckets; private final int _size; private final int _mask; public ReadOnlyClassToSerializerMap(LRUMap<TypeKey,JsonSerializer<Object>> src) { _size = findSize(src.size()); _mask = (_size-1); Bucket[] buckets = new Bucket[_size]; src.contents((key, value) -> { int index = key.hashCode() & _mask; buckets[index] = new Bucket(buckets[index], key, value); }); _buckets = buckets; } private final static int findSize(int size) { // For small enough results (64 or less), we'll require <= 50% fill rate; otherwise 80% int needed = (size <= 64) ? (size + size) : (size + (size >> 2)); int result = 8; while (result < needed) { result += result; } return result; } /** * Factory method for constructing an instance. */ public static ReadOnlyClassToSerializerMap from(LRUMap<TypeKey, JsonSerializer<Object>> src) { return new ReadOnlyClassToSerializerMap(src); } /* /********************************************************** /* Public API /********************************************************** */ public int size() { return _size; } public JsonSerializer<Object> typedValueSerializer(JavaType type) { Bucket bucket = _buckets[TypeKey.typedHash(type) & _mask]; if (bucket == null) { return null; } if (bucket.matchesTyped(type)) { return bucket.value; } while ((bucket = bucket.next) != null) { if (bucket.matchesTyped(type)) { return bucket.value; } } return null; } public JsonSerializer<Object> typedValueSerializer(Class<?> type) { Bucket bucket = _buckets[TypeKey.typedHash(type) & _mask]; if (bucket == null) { return null; } if (bucket.matchesTyped(type)) { return bucket.value; } while ((bucket = bucket.next) != null) { if (bucket.matchesTyped(type)) { return bucket.value; } } return null; } public JsonSerializer<Object> untypedValueSerializer(JavaType type) { Bucket bucket = _buckets[TypeKey.untypedHash(type) & _mask]; if (bucket == null) { return null; } if (bucket.matchesUntyped(type)) { return bucket.value; } while ((bucket = bucket.next) != null) { if (bucket.matchesUntyped(type)) { return bucket.value; } } return null; } public JsonSerializer<Object> untypedValueSerializer(Class<?> type) { Bucket bucket = _buckets[TypeKey.untypedHash(type) & _mask]; if (bucket == null) { return null; } if (bucket.matchesUntyped(type)) { return bucket.value; } while ((bucket = bucket.next) != null) { if (bucket.matchesUntyped(type)) { return bucket.value; } } return null; } /* /********************************************************** /* Helper classes /********************************************************** */ private final static class Bucket { public final JsonSerializer<Object> value; public final Bucket next; protected final Class<?> _class; protected final JavaType _type; protected final boolean _isTyped; public Bucket(Bucket next, TypeKey key, JsonSerializer<Object> value) { this.next = next; this.value = value; _isTyped = key.isTyped(); _class = key.getRawType(); _type = key.getType(); } public boolean matchesTyped(Class<?> key) { return (_class == key) && _isTyped; } public boolean matchesUntyped(Class<?> key) { return (_class == key) && !_isTyped; } public boolean matchesTyped(JavaType key) { return _isTyped && key.equals(_type); } public boolean matchesUntyped(JavaType key) { return !_isTyped && key.equals(_type); } } }
⏎ com/fasterxml/jackson/databind/ser/impl/ReadOnlyClassToSerializerMap.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, 109198👍, 0💬
Popular Posts:
JUnit Source Code Files are provided in the source package file, junit-4.13.2-sources.jar .You can b...
JDK 11 java.xml.jmod is the JMOD file for JDK 11 XML (eXtensible Markup Language) module. JDK 11 XML...
JSP(tm) Standard Tag Library 1.0 implementation - Jakarta Taglibs hosts the Standard Taglib 1.0, an ...
JSP(tm) Standard Tag Library 1.1 implementation - Jakarta Taglibs hosts the Standard Taglib 1.1, an ...
JLayer is a library that decodes/plays/converts MPEG 1/2/2.5 Layer 1/2/3 (i.e. MP3) in real time for...