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/type/TypeBase.java
package com.fasterxml.jackson.databind.type; import java.io.IOException; import java.lang.reflect.TypeVariable; import java.util.*; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.core.type.WritableTypeId; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; public abstract class TypeBase extends JavaType implements JsonSerializable { private static final long serialVersionUID = 1; private final static TypeBindings NO_BINDINGS = TypeBindings.emptyBindings(); private final static JavaType[] NO_TYPES = new JavaType[0]; protected final JavaType _superClass; protected final JavaType[] _superInterfaces; /** * Bindings in effect for this type instance; possibly empty. * Needed when resolving types declared in members of this type * (if any). * * @since 2.7 */ protected final TypeBindings _bindings; /** * Lazily initialized external representation of the type */ volatile transient String _canonicalName; /** * Main constructor to use by extending classes. */ protected TypeBase(Class<?> raw, TypeBindings bindings, JavaType superClass, JavaType[] superInts, int hash, Object valueHandler, Object typeHandler, boolean asStatic) { super(raw, hash, valueHandler, typeHandler, asStatic); _bindings = (bindings == null) ? NO_BINDINGS : bindings; _superClass = superClass; _superInterfaces = superInts; } /** * Copy-constructor used when refining/upgrading type instances. * * @since 2.7 */ protected TypeBase(TypeBase base) { super(base); _superClass = base._superClass; _superInterfaces = base._superInterfaces; _bindings = base._bindings; } @Override public String toCanonical() { String str = _canonicalName; if (str == null) { str = buildCanonicalName(); } return str; } protected String buildCanonicalName() { return _class.getName(); } @Override public abstract StringBuilder getGenericSignature(StringBuilder sb); @Override public abstract StringBuilder getErasedSignature(StringBuilder sb); @Override public TypeBindings getBindings() { return _bindings; } @Override public int containedTypeCount() { return _bindings.size(); } @Override public JavaType containedType(int index) { return _bindings.getBoundType(index); } @Override @Deprecated public String containedTypeName(int index) { return _bindings.getBoundName(index); } @Override public JavaType getSuperClass() { return _superClass; } @Override public List<JavaType> getInterfaces() { if (_superInterfaces == null) { return Collections.emptyList(); } switch (_superInterfaces.length) { case 0: return Collections.emptyList(); case 1: return Collections.singletonList(_superInterfaces[0]); } return Arrays.asList(_superInterfaces); } @Override public final JavaType findSuperType(Class<?> rawTarget) { if (rawTarget == _class) { return this; } // Check super interfaces first: if (rawTarget.isInterface() && (_superInterfaces != null)) { for (int i = 0, count = _superInterfaces.length; i < count; ++i) { JavaType type = _superInterfaces[i].findSuperType(rawTarget); if (type != null) { return type; } } } // and if not found, super class and its supertypes if (_superClass != null) { JavaType type = _superClass.findSuperType(rawTarget); if (type != null) { return type; } } return null; } @Override public JavaType[] findTypeParameters(Class<?> expType) { JavaType match = findSuperType(expType); if (match == null) { return NO_TYPES; } return match.getBindings().typeParameterArray(); } /* /********************************************************** /* JsonSerializable base implementation /********************************************************** */ @Override public void serializeWithType(JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer) throws IOException { WritableTypeId typeIdDef = new WritableTypeId(this, JsonToken.VALUE_STRING); typeSer.writeTypePrefix(g, typeIdDef); this.serialize(g, provider); typeSer.writeTypeSuffix(g, typeIdDef); } @Override public void serialize(JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeString(toCanonical()); } /* /********************************************************** /* Methods for sub-classes to use /********************************************************** */ /** * @param trailingSemicolon Whether to add trailing semicolon for non-primitive * (reference) types or not */ protected static StringBuilder _classSignature(Class<?> cls, StringBuilder sb, boolean trailingSemicolon) { if (cls.isPrimitive()) { if (cls == Boolean.TYPE) { sb.append('Z'); } else if (cls == Byte.TYPE) { sb.append('B'); } else if (cls == Short.TYPE) { sb.append('S'); } else if (cls == Character.TYPE) { sb.append('C'); } else if (cls == Integer.TYPE) { sb.append('I'); } else if (cls == Long.TYPE) { sb.append('J'); } else if (cls == Float.TYPE) { sb.append('F'); } else if (cls == Double.TYPE) { sb.append('D'); } else if (cls == Void.TYPE) { sb.append('V'); } else { throw new IllegalStateException("Unrecognized primitive type: "+cls.getName()); } } else { sb.append('L'); String name = cls.getName(); for (int i = 0, len = name.length(); i < len; ++i) { char c = name.charAt(i); if (c == '.') c = '/'; sb.append(c); } if (trailingSemicolon) { sb.append(';'); } } return sb; } /** * Internal helper method used to figure out nominal super-class for * deprecated factory methods / constructors, where we are not given * properly resolved supertype hierarchy. * Will basically give `JavaType` for `java.lang.Object` for classes * other than `java.lafgn.Object`; null for others. * * @since 2.7 */ protected static JavaType _bogusSuperClass(Class<?> cls) { Class<?> parent = cls.getSuperclass(); if (parent == null) { return null; } return TypeFactory.unknownType(); } protected boolean _hasNTypeParameters(int count) { TypeVariable<?>[] params = _class.getTypeParameters(); return (params.length == count); } }
⏎ com/fasterxml/jackson/databind/type/TypeBase.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, 110697👍, 0💬
Popular Posts:
maven-compat-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Compact module. The JAR file name may ...
What Is mail.jar of JavaMail 1.3? I got the JAR file from javamail-1_3.zip. mail.jar in javamail-1_3...
JDK 11 jdk.compiler.jmod is the JMOD file for JDK 11 Compiler tool, which can be invoked by the "jav...
How to download and install JDK (Java Development Kit) 6? If you want to write Java applications, yo...
jlGui is a music player for the Java platform. It is based on Java Sound 1.0 (i.e. JDK 1.3+). It sup...