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/ser/std/IterableSerializer.java
package com.fasterxml.jackson.databind.ser.std;
import java.io.IOException;
import java.util.*;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.ser.ContainerSerializer;
@JacksonStdImpl
@SuppressWarnings("serial")
public class IterableSerializer
extends AsArraySerializerBase<Iterable<?>>
{
public IterableSerializer(JavaType elemType, boolean staticTyping,
TypeSerializer vts) {
super(Iterable.class, elemType, staticTyping, vts, null);
}
public IterableSerializer(IterableSerializer src, BeanProperty property,
TypeSerializer vts, JsonSerializer<?> valueSerializer,
Boolean unwrapSingle) {
super(src, property, vts, valueSerializer, unwrapSingle);
}
@Override
public ContainerSerializer<?> _withValueTypeSerializer(TypeSerializer vts) {
return new IterableSerializer(this, _property, vts, _elementSerializer, _unwrapSingle);
}
@Override
public IterableSerializer withResolved(BeanProperty property,
TypeSerializer vts, JsonSerializer<?> elementSerializer,
Boolean unwrapSingle) {
return new IterableSerializer(this, property, vts, elementSerializer, unwrapSingle);
}
@Override
public boolean isEmpty(SerializerProvider prov, Iterable<?> value) {
// Not really good way to implement this, but has to do for now:
return !value.iterator().hasNext();
}
@Override
public boolean hasSingleElement(Iterable<?> value) {
// we can do it actually (fixed in 2.3.1)
if (value != null) {
Iterator<?> it = value.iterator();
if (it.hasNext()) {
it.next();
if (!it.hasNext()) {
return true;
}
}
}
return false;
}
@Override
public final void serialize(Iterable<?> value, JsonGenerator gen,
SerializerProvider provider)throws IOException
{
if (((_unwrapSingle == null) &&
provider.isEnabled(SerializationFeature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED))
|| (_unwrapSingle == Boolean.TRUE)) {
if (hasSingleElement(value)) {
serializeContents(value, gen, provider);
return;
}
}
gen.writeStartArray(value);
serializeContents(value, gen, provider);
gen.writeEndArray();
}
@Override
public void serializeContents(Iterable<?> value, JsonGenerator jgen,
SerializerProvider provider) throws IOException
{
Iterator<?> it = value.iterator();
if (it.hasNext()) {
final TypeSerializer typeSer = _valueTypeSerializer;
JsonSerializer<Object> prevSerializer = null;
Class<?> prevClass = null;
do {
Object elem = it.next();
if (elem == null) {
provider.defaultSerializeNull(jgen);
continue;
}
JsonSerializer<Object> currSerializer = _elementSerializer;
if (currSerializer == null) {
// Minor optimization to avoid most lookups:
Class<?> cc = elem.getClass();
if (cc == prevClass) {
currSerializer = prevSerializer;
} else {
currSerializer = provider.findValueSerializer(cc, _property);
prevSerializer = currSerializer;
prevClass = cc;
}
}
if (typeSer == null) {
currSerializer.serialize(elem, jgen, provider);
} else {
currSerializer.serializeWithType(elem, jgen, provider, typeSer);
}
} while (it.hasNext());
}
}
}
⏎ com/fasterxml/jackson/databind/ser/std/IterableSerializer.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, ≈297🔥, 0💬
Popular Posts:
JRE 8 plugin.jar is the JAR file for JRE 8 Java Control Panel Plugin interface and tools. JRE (Java ...
iText is an ideal library for developers looking to enhance web- and other applications with dynamic...
What Is commons-collections4-4.4 .jar?commons-collections4-4.4 .jaris the JAR file for Apache Common...
How to download and install iText7-Core-7.1.4.zip? iText7-Core-7.1.4.zip is the binary package of iT...
Where to get the Java source code for Connector/J 8.0 Protocol Impl module? Java source code files f...