Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
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/jsontype/impl/TypeSerializerBase.java
package com.fasterxml.jackson.databind.jsontype.impl;
import java.io.IOException;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.type.WritableTypeId;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
public abstract class TypeSerializerBase extends TypeSerializer
{
protected final TypeIdResolver _idResolver;
protected final BeanProperty _property;
protected TypeSerializerBase(TypeIdResolver idRes, BeanProperty property)
{
_idResolver = idRes;
_property = property;
}
/*
/**********************************************************
/* Base implementations, simple accessors
/**********************************************************
*/
@Override
public abstract JsonTypeInfo.As getTypeInclusion();
@Override
public String getPropertyName() { return null; }
@Override
public TypeIdResolver getTypeIdResolver() { return _idResolver; }
@Override
public WritableTypeId writeTypePrefix(JsonGenerator g,
WritableTypeId idMetadata) throws IOException
{
_generateTypeId(idMetadata);
// 16-Jan-2022, tatu: As per [databind#3373], skip for null typeId.
// And return "null" so that matching "writeTypeSuffix" call should
// be avoided as well.
if (idMetadata.id == null) {
return null;
}
return g.writeTypePrefix(idMetadata);
}
@Override
public WritableTypeId writeTypeSuffix(JsonGenerator g,
WritableTypeId idMetadata) throws IOException
{
// 16-Jan-2022, tatu: As per [databind#3373], skip for null:
if (idMetadata == null) {
return null;
}
return g.writeTypeSuffix(idMetadata);
}
/**
* Helper method that will generate type id to use, if not already passed.
*
* @since 2.9
*/
protected void _generateTypeId(WritableTypeId idMetadata) {
Object id = idMetadata.id;
if (id == null) {
final Object value = idMetadata.forValue;
Class<?> typeForId = idMetadata.forValueType;
if (typeForId == null) {
id = idFromValue(value);
} else {
id = idFromValueAndType(value, typeForId);
}
idMetadata.id = id;
}
}
/*
/**********************************************************
/* Helper methods for subclasses
/**********************************************************
*/
protected String idFromValue(Object value) {
String id = _idResolver.idFromValue(value);
if (id == null) {
handleMissingId(value);
}
return id;
}
protected String idFromValueAndType(Object value, Class<?> type) {
String id = _idResolver.idFromValueAndType(value, type);
if (id == null) {
handleMissingId(value);
}
return id;
}
// As per [databind#633], maybe better just not do anything...
protected void handleMissingId(Object value) {
/*
String typeDesc = ClassUtil.classNameOf(value, "NULL");
throw new IllegalArgumentException("Cannot resolve type id for "
+typeDesc+" (using "+_idResolver.getClass().getName()+")");
*/
}
}
⏎ com/fasterxml/jackson/databind/jsontype/impl/TypeSerializerBase.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, ≈278🔥, 0💬
Popular Posts:
JSP(tm) Standard Tag Library 1.0 implementation - Jakarta Taglibs hosts the Standard Taglib 1.0, an ...
maven-model-builder-3.8. 6.jaris the JAR file for Apache Maven 3.8.6 Model Builder module. Apache Ma...
What JAR files are required to run sax\Counter.java provided in the Apache Xerces package? You can f...
Where to get the Java source code for Connector/J 8.0 User API module? Java source code files for Co...
commons-io-1.4.jar is the JAR file for Commons IO 1.4, which is a library of utilities to assist wit...