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/impl/WritableObjectId.java
package com.fasterxml.jackson.databind.ser.impl;
import java.io.IOException;
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.SerializableString;
import com.fasterxml.jackson.databind.SerializerProvider;
/**
* Simple value container used to keep track of Object Ids during
* serialization.
*/
public final class WritableObjectId
{
public final ObjectIdGenerator<?> generator;
public Object id;
/**
* Marker to denote whether Object Id value has been written as part of an Object,
* to be referencible. Remains false when forward-reference is written.
*/
protected boolean idWritten = false;
public WritableObjectId(ObjectIdGenerator<?> generator) {
this.generator = generator;
}
public boolean writeAsId(JsonGenerator gen, SerializerProvider provider, ObjectIdWriter w) throws IOException
{
if ((id != null) && (idWritten || w.alwaysAsId)) {
// 03-Aug-2013, tatu: Prefer Native Object Ids if available
if (gen.canWriteObjectId()) {
gen.writeObjectRef(String.valueOf(id));
} else {
w.serializer.serialize(id, gen, provider);
}
return true;
}
return false;
}
public Object generateId(Object forPojo) {
// 04-Jun-2016, tatu: As per [databind#1255], need to consider possibility of
// id being generated for "alwaysAsId", but not being written as POJO; regardless,
// need to use existing id if there is one:
if (id == null) {
id = generator.generateId(forPojo);
}
return id;
}
/**
* Method called to output Object Id as specified.
*/
public void writeAsField(JsonGenerator gen, SerializerProvider provider,
ObjectIdWriter w) throws IOException
{
idWritten = true;
// 03-Aug-2013, tatu: Prefer Native Object Ids if available
if (gen.canWriteObjectId()) {
// Need to assume String(ified) ids, for now... could add 'long' variant?
// 05-Feb-2019, tatu: But in special case of `null` we should not coerce -- whether
// we should even call is an open question, but for now do pass to let generator
// decide what to do, if anything.
String idStr = (id == null) ? null : String.valueOf(id);
gen.writeObjectId(idStr);
return;
}
SerializableString name = w.propertyName;
if (name != null) {
// 05-Feb-2019, tatu: How about `null` id? For now, write
gen.writeFieldName(name);
w.serializer.serialize(id, gen, provider);
}
}
}
⏎ com/fasterxml/jackson/databind/ser/impl/WritableObjectId.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, ≈298🔥, 0💬
Popular Posts:
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...
What Is poi-scratchpad-5.2.3.jar ?poi-scratchpad-5.2.3.jar is one of the JAR files for Apache POI 5....
What Is junit-3.8.1.jar? junit-3.8.1.jar is the version 3.8.1 of JUnit JAR library file. JUnit is a ...
Snappy-Java is a Java port of the "snappy", a fast C++ compresser/decompresser developed by Google. ...
JDK 17 jdk.charsets.jmod is the JMOD file for JDK 17 Charsets module. JDK 17 Charsets module compile...