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/AsExternalTypeSerializer.java
package com.fasterxml.jackson.databind.jsontype.impl;
import java.io.IOException;
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
/**
* Type serializer that preferably embeds type information as an "external"
* type property; embedded in enclosing JSON object.
* Note that this serializer should only be used when value is being output
* at JSON Object context; otherwise it cannot work reliably, and will have
* to revert operation similar to {@link AsPropertyTypeSerializer}.
*<p>
* Note that implementation of serialization is bit cumbersome as we must
* serialized external type id AFTER object; this because callback only
* occurs after field name has been written.
*<p>
* Also note that this type of type id inclusion will NOT try to make use
* of native Type Ids, even if those exist.
*/
public class AsExternalTypeSerializer extends TypeSerializerBase
{
protected final String _typePropertyName;
public AsExternalTypeSerializer(TypeIdResolver idRes, BeanProperty property, String propName) {
super(idRes, property);
_typePropertyName = propName;
}
@Override
public AsExternalTypeSerializer forProperty(BeanProperty prop) {
return (_property == prop) ? this : new AsExternalTypeSerializer(_idResolver, prop, _typePropertyName);
}
@Override
public String getPropertyName() { return _typePropertyName; }
@Override
public As getTypeInclusion() { return As.EXTERNAL_PROPERTY; }
/*
/**********************************************************
/* Helper methods
/**********************************************************
*/
// nothing to wrap it with:
protected final void _writeScalarPrefix(Object value, JsonGenerator g) throws IOException { }
protected final void _writeObjectPrefix(Object value, JsonGenerator g) throws IOException {
g.writeStartObject();
}
protected final void _writeArrayPrefix(Object value, JsonGenerator g) throws IOException {
g.writeStartArray();
}
protected final void _writeScalarSuffix(Object value, JsonGenerator g, String typeId) throws IOException {
if (typeId != null) {
g.writeStringField(_typePropertyName, typeId);
}
}
protected final void _writeObjectSuffix(Object value, JsonGenerator g, String typeId) throws IOException {
g.writeEndObject();
if (typeId != null) {
g.writeStringField(_typePropertyName, typeId);
}
}
protected final void _writeArraySuffix(Object value, JsonGenerator g, String typeId) throws IOException {
g.writeEndArray();
if (typeId != null) {
g.writeStringField(_typePropertyName, typeId);
}
}
}
⏎ com/fasterxml/jackson/databind/jsontype/impl/AsExternalTypeSerializer.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, ≈244🔥, 0💬
Popular Posts:
JEuclid Source Code Files are provided the JEuclid GitHub Website . You can browse JEuclid Source Co...
Apache Log4j API provides the interface that applications should code to and provides the adapter co...
JDK 11 java.base.jmod is the JMOD file for JDK 11 Base module. JDK 11 Base module compiled class fil...
JDK 17 jdk.jdeps.jmod is the JMOD file for JDK 17 JDeps tool, which can be invoked by the "jdeps" co...
commons-io-2.6-sources.j aris the source JAR file for Apache Commons IO 2.6, which is a library of u...